Python in R

reticulate is an R package that brings Python into R.

library(reticulate)
 
# use project specific python packages stored in folder created with
#    python -m venv .venv
use_virtualenv(".venv") # analogous to 'source .venv/bin/activate'

The RStudio environment explorer (top right) shows python variables and matplotlib graphs show up in the plot browser!

See https://rstudio.github.io/reticulate/