R from Python – an rpy2 tutorial

rpy2 tutorial

This tutorial covers the integration between R and Python using the rpy2 package. Discover how to bridge the gap between these two languages, enabling you to make use of both languages’ strengths for enhanced data analysis and visualization. This rpy2 tutorial guides you through its installation, configuration, and practical usage.

Outline

In this tutorial, we will learn how to use rpy2 to install r packages and run r functions to conduct data analysis and visualization. We will learn how to use the r-packages ‘afex‘ and ‘emmeans‘,  using Python and rpy2.  Finally, we will also learn how to display R plots in Jupyter notebooks using rpy2, using two different methods.

Obviously, rpy2 requires that we have both R (version +3.2.x) and Python (versions 2.7 and 3.X) installed. Pre-compiled binaries are available for Linux and Windows (although they are unsupported and unofficial).

Read more