Rpy2 Tutorial: How to Run R in Python
In this tutorial, we will learn how to use rpy2 to install r packages and run r functions to carry out data analysis and data visualization. More specifically, we will learn how to sue the r packages 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. There are pre-compiled binaries available for Linux and Windows (unsupported and unofficial, however).