R Markdown is very nice way to write literate R code. Recently,
[reticulate](https://rstudio.github.io/reticulate/) became available, which bridges R and Python in R Markdown documents.
If you use Pipenv for Python dependency management, here's how you get
reticulate to use the proper Python executable:
library('reticulate') venv <- system("pipenv --venv", inter = TRUE) use_virtualenv(venv, required = TRUE) py_config()
py_config() command should print out the path to the Python executable in the
virtualenv created by Pipenv.