1 min read

Announcing the Reticulate package, an R interface to Python. This package consists of comprehensive set of tools for interoperability between Python and R.

With this new package, one can:

  • Call Python from R in several ways including R Markdown, sourcing Python scripts, importing Python modules, and using Python interactively within an R session.
  • Translate between R and Python objects (for example, between R and Pandas data frames, or between R matrices and NumPy arrays).
  • Bind to different versions of Python including virtual environments and Conda environments in a flexible manner.
  • Reticulate embeds a Python session within one’s R session, enabling seamless, high-performance interoperability.
  • It can dramatically streamline the workflow for R developers who use Python for their experiments or for a member of data science team that use both the languages.

Python in R Markdown

The reticulate package also includes a Python engine for R Markdown which has following  features:

  • It can run Python chunks in a single Python session embedded within one’s R session (shared variables/state between Python chunks)
  • Prints Python output, including graphical output from matplotlib.
  • Access to objects created within Python chunks from R using the py object (e.g. py$x would access an x variable created within Python from R).
  • Access to objects created within R chunks from Python using the r object (e.g. r.x would access to x variable created within R from Python)

Built in conversion for many Python object types is provided, including NumPy arrays and Pandas data frames. One can also use Pandas to read and manipulate data, and easily plot the Pandas data frame using ggplot2.

Read more about the Reticulate package in detail on R Studio GitHub Repo

 

A Data science fanatic. Loves to be updated with the tech happenings around the globe. Loves singing and composing songs. Believes in putting the art in smart.

LEAVE A REPLY

Please enter your comment!
Please enter your name here