reticulate R library for Python+R use #3920
Replies: 6 comments 9 replies
-
Can you share a bit more detail about what you would like to be able to do? Maybe a simple example that demonstrates the missing functionality? |
Beta Was this translation helpful? Give feedback.
-
Hello, Sure, I can provide a simple example. If I open a fresh RStudio instance, and create two new scripts:
In the R script I would run: library(reticulate)
r_variable <- c(1,2,3) Then I can tab over to the Python script, and run import numpy as np
import pandas as pd Since I've ran So I tab over to the RScript, then run py$r_variable <- r_variable This should make the variable accessible in the Python script. Now I tab back to the Python script, and run r_variable Which returns a Still in the Python script, I can now run py_df = pd.DataFrame(r_variable,index=['a','b','c']) Now I want to access this variable in R, so I tab back to the R Script, and run py$py_df which will return a It's a silly example, but in a serious workflow, it's a way to work with the same variables, transferring them back and forth between R and Python. Please let me know if you have any other questions. Thank you |
Beta Was this translation helpful? Give feedback.
-
I'm in the same boat as @erolbicero Has anyone figured out a good way to use both R and python in a Jupyter notebook? Something like this: (The example is from https://www.appsilon.com/post/introducing-positron, but I'm not convinced by the screenshot that the author got it to actually work. When I try the same thing the "R" cell can only run python code.) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
FWIW, I think this be the truly 'killer functionality' in positron/quarto if it were possible. After all, to support multi-lingual teams, it would be great if someone's python code were augmented by another person's R code, with work continuing thereafter (in either language). The passing of variables between R and python code chunks (with environments managed) sounds really challenging from a technical perspective but would be perfect for this user. To be clear, I'm agnostic on how you might achieve this as the functionality is key (and I trust your design choices more than mine). Continued thanks for all your great work. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, We have added support for reticulate console sessions in #4603. It's currently turned off by default, but can be enabled by toggling the We'd love to hear your feedback on this feature. Thank you very much! |
Beta Was this translation helpful? Give feedback.
-
Hello,
I like the IDE and its potential. One of the powerful features of RStudio is the ability to pass variables back and forth between R and Python through the reticulate library.
Are there any plans to get this functionality in Positron? I've tried using reticulate, and although it can run python, I can't jump back and forth between scripts like I can in RStudio.
Beta Was this translation helpful? Give feedback.
All reactions