Skip to content
Examples of using Python with Jupyter Notebooks, Shiny apps, R Markdown documents, and Plumber APIs
Jupyter Notebook Other
Branch: master
Clone or download
danielfrg Merge pull request #7 from sol-eng/gpt-2-example
Add GPT-2 transformer example
Latest commit 928662b May 15, 2019

Using R with Python


The reticulate package provides a comprehensive set of tools for interoperability between Python and R. You can use Python for the following:

  • Call Python from R
  • Use Python with R Markdown, Shiny, and R scripts
  • Source Python scripts
  • Import Python modules
  • Use Python interactively within an R session
  • Translate between R and Pandas data frames
  • Translate between R matrices and NumPy arrays
  • Bind with Virtualenv
  • Bind with Conda environments

RStudio Connect

You can publish Jupyter notebooks to RStudio connect. The RStudio plugin for Jupyter allows you to publish Jupyter notebooks with the press of a button. Once published on RStudio Connect, these notebooks can be scheduled for updates or refreshed on demand.


Getting Started

  • Clone this repository

  • Install Python on your machine

  • Set the RETICULATE_PYTHON environment variable to point to your installation of Python, for example using the following line in your ~/.Rprofile:

    Sys.setenv(RETICULATE_PYTHON = '/usr/local/bin/python')
  • Run the examples

  • Publish the examples with source code to RStudio Connect


The intent of the reticulate package is to integrate Python into R projects, and are not intended for standalone Python work. There are many IDEs available for doing data science with Python including JupyterLab, Rodeo, Spyder, and Visual Studio Code, and we strongly recommend using one of them for Python-only projects. However, if you are using reticulated Python within an R project then RStudio provides a set of tools that we think you will find extremely helpful.

You can’t perform that action at this time.