the screenshot for jupyternotebook
I've successfully installed ryp2 using wheel. I'm using Python 3.7.6 and rpy2 2.9.5. I can get the output from jupter notebook when running python code but it doesn't work when using R magic. I tried to see if I can really use R by installing 'ggplot2' and it worked with installation bar poped out.
However, I cannot get any output when I use R magic.
Errors will come out like this. The error is so weird Error in withVisible({ : object 'returns' not found. returns is a python dataframe and was not converted to r object.
Error in withVisible({
Other error like below. Error in eval(predvars, data, env) : object 'p' not found. Neither p nor q is initialized.
Error in eval(predvars, data, env)
Anyone encountered the same problem? Thank you very much in advance!
FYI: packages version
This is only a partial answer; I do not know why you cannot see output of
1for:but I know that the "errors" you see are there because the variables are indeed not defined - you still need to tell rpy2 to import (
-ifor input) or export (-ofor output) variables between R and Python namespaces, this does not happen automatically (if it did you would end up with each object taking up twice as much space!). This is done using:And
(or equivalently using
%%R). It means that in your examples in order to Pythonprint(a)you first need to:And to have Python variable
b, sayb = 1in R you would need to:Please read the documentation for using rpy2 in notebooks (magics are covered near the end) and the documentation of RMagic, as it is already explained in there.
I hope you will get an answer on the non-functioning R output soon. If you do not get one in the next few days please consider opening a bug report on rpy2 GitHub.