rstudio/reticulate

R Interface to Python

What it solves

It bridges the gap between R and Python, allowing developers to use both languages within a single project. It eliminates the need to choose between the two by enabling seamless data sharing, function execution, and environment management between R and Python sessions.

How it works

It embeds a Python session directly into your R session. It handles the "heavy lifting" of converting data types automatically—for example, turning R data frames into Pandas data frames or R matrices into NumPy arrays. You can interact with Python by importing modules, running Python scripts, using an interactive Python console (REPL) inside R, or writing Python code chunks directly within R Markdown documents.

Who it’s for

R developers who need to leverage Python libraries, or data science teams that work in mixed-language environments and want to streamline their workflow by combining the strengths of both languages.

Highlights

  • Bi-directional communication: Access R objects from Python and Python objects from R.
  • Flexible environment support: Easily bind to specific Python versions, virtual environments, or Conda environments.
  • R Markdown integration: Run Python code chunks alongside R code with shared state and automatic output rendering.
  • Automatic type conversion: Seamlessly maps R data types to their Python equivalents (and vice-versa) for lists, arrays, and data frames.
  • Interactive development: Includes a built-in Python console that lives inside your R session.

Related

  • Project
  • Project
  • Project
  • Project