Can anyone share their setup for Quarto documents that use both Python and R code blocks? #8253
-
DescriptionI am exploring Quarto documents that have both executable Python and R code. As far as I know, this can be achieved be either:
I am curious to know if anyone has a working setup of this that I can reference. Particularly, I am interested to better understand:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Not a complete answer, but I'm trying to bring some elements of what I know.
Regarding R with knitr and reticulate for Python, renv (https://rstudio.github.io/renv/) can handle R and Python dependencies for the same project. More on Python integration at: https://rstudio.github.io/renv/articles/python.html
reticulate (https://rstudio.github.io/reticulate) is what allows to run Python from R. it is well integrated in RStudio IDE (https://rstudio.github.io/reticulate/articles/rstudio_ide.html) and python code cell can be run from the IDE
Are you using the Quarto extension https://marketplace.visualstudio.com/items?itemName=quarto.quarto ?
I think this option won't allow Never tried though. |
Beta Was this translation helpful? Give feedback.
-
This is a biology-specific application, but this vignette I wrote uses R & Python code chunks in the same document. Click the Code -> View source button at the top and you can see the YAML header options I used. |
Beta Was this translation helpful? Give feedback.
-
For those who land here, in my case, I was looking for this piece of code : ```{r}
#| echo : false
reticulate::use_virtualenv(’ ../../.venv ’)
``` where |
Beta Was this translation helpful? Give feedback.
Not a complete answer, but I'm trying to bring some elements of what I know.
Regarding R with knitr and reticulate for Python, renv (https://rstudio.github.io/renv/) can handle R and Python dependencies for the same project. More on Python integration at: https://rstudio.github.io/renv/articles/python.html
reticulate (https://rstudio.github.io/reticulate) is what allows to run Python from R. it is well integrated in RStudio IDE (https://rstudio.github.io/reticulate/articles/rstudio_ide.html) and p…