-
Hi all, I want to build a revealjs presentation that includes Python and R code. If I understand correctly, in R the Python code is ran by the {reticulate} package.
My main goal is to include reproducible examples in both languages, not sure what is the best way of doing this... Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Both ways are "good":
In both cases, you need to be sure the engine is seeing the proper collection of R packages or Python libraries, i.e., you might need some extra step to help rpy2 locate your R library or to help reticulate locate your Python library. Your issue with knitr + reticulate not able to use some your Python libraries is a setup issue. |
Beta Was this translation helpful? Give feedback.
-
Just to clarify, all execution of code happens through a single engine. If you use the jupyter engine, then you get rpy2 for R code; If you use the knitr engine, than you get reticulate for Python code. In other words, each .qmd file is always handled by a single execution engine. |
Beta Was this translation helpful? Give feedback.
Both ways are "good":
In both cases, you need to be sure the engine is seeing the proper collection of R packages or Python libraries, i.e., you might need some extra step to help rpy2 locate your R library or to help reticulate locate your Python library.
Your issue with knitr + reticulate not able to use some your Python libraries is a setup issue.
I am no expert of reticulate, but I know you can set the location of your Python install and/or install python modules/libraries using reticulate. Both should help solve your issue.