Comments (14)
It's all that matters whether the environment (jupyter, rstudio, etc) exposes the source code at runtime. datar
/pipda
depends on executing
to detect the node to tell whether the verbs are calling regularly (e.g. dim(df)
) or by piping (df >> dim()
). executing
did not work for jupyter before, but later it adopted jupyter environment. I will see what I can do with the Rstudio environment.
from datar.
This is because the source code is not available for datar
/pipda
to detect the piping syntax.
See also the following for solutions:
https://pwwang.github.io/datar/caveats/blind/
from datar.
Hi @pwwang, I did look at the documentation and did figure it out yet. can you provide an example to do the following in RStudio notebook ?
```{python}
from datar.all import *
from datar.datasets import mtcars
mtcars >> mutate(carb_2 = f.carb)
```
from datar.
Here you go:
```{python}
from pipda import options
from datar.all import *
from datar.datasets import mtcars
options.assume_all_piping = True
mtcars >> mutate(carb_2 = f.carb)
```
from datar.
It did not work, look at the snapshot below:
from datar.
Ah, my bad. options.assume_all_piping = True
should go before the datar
importing.
The following should work:
```{python}
from pipda import options
options.assume_all_piping = True
from datar.all import *
from datar.datasets import mtcars
mtcars >> mutate(carb_2 = f.carb)
```
from datar.
It worked, thanks @pwwang
from datar.
If in Rsutio with the latest version , it both works whether options.assume_all_piping = True
goes before the datar importing or not.
from datar.
@pwwang @rleyvasal
In the latest Rstudio (version 2021.09.0 ),it both works whether options.assume_all_piping = True
goes before the datar importing or not.
{python}
from datar.all import *
from pipda import options,register_verb
from datar.datasets import mtcars
options.assume_all_piping = True
mtcars >> mutate(carb_2=f.carb)
from datar.
@antonio-yu
Good to know. I believe it's more related to R
/reticulate
version.
Theoretically, it should work no matter options.assume_all_piping = True
goes before or after datar importing.
from datar.
@antonio-yu, I can confirm that in the latest version of Rstudio (version 2021.09.0 ), options.assume_all_piping = True
works irrespective of where it is entered - this is not an issue anymore.
from datar.
Then I will close this for now. If you have any related questions, feel free to reopen it or open new issues.
from datar.
@pwwang, just curious, do you know why the pipes work without pipda
configuration in VSCode's Jupyter notebooks? but in RStudio notebooks we have to enter the following:
```{python}
from pipda import options
options.assume_all_piping = True
```
from datar.
@rleyvasal Just took a look at how Rstudio is running python. It actually executes python code with something like eval()
wrapped by reticulate
. It does not ship with the source code. So currently we need that assumption to let datar
work. But I will keep on an eye on reticulate
's evolution, and see if it'll be possible in the future. And maybe submit an issue to the repo at some time point.
from datar.
Related Issues (20)
- [ENH] Support dplyr 1.0.9
- [ENH] Support dplyr 1.1.0~1.1.2
- [ENH] Support tidyr 1.3.0
- [ENH] Support forcats 1.0.0
- [BUG] if_else() is evaluating `true statement` even when the `condition` is `false` HOT 2
- [ENH] From "with_groups()" to "by" within verbs.... HOT 2
- [QST] error import filter HOT 1
- Cannot import name 'filter' from 'datar.dplyr' HOT 1
- [QST] Warning: PipeableCallCheckWarning: Failed to detect AST node calling `mutate`, assuming a piping call. HOT 6
- warning HOT 1
- [QST] How to use a custom function in mutate? HOT 6
- [ENH] Adding transformation functions oriented to modeling. HOT 2
- [BUG] signif function crashes with 0 HOT 5
- [BUG] warnings when using pipe HOT 1
- [ENH] Support for lets-plot HOT 3
- [QST] is asof join supported? HOT 4
- head does not work with pipe [BUG] HOT 1
- PipeableCallCheckWarning: Failed to detect AST node calling `xxx`, assuming a normal call
- how to use %in% HOT 1
- [BUG] incompatible with pandas 2.2.1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datar.