Member-only story

How to Use Python in R with Reticulate and Conda

Set up Reticulate in two simple steps and get the most out of R and Python libraries

Denisa Blackwood
Save The Data
6 min readOct 24, 2021

--

Graphic by the author.

We’ve all been there once or twice: you know the perfect Python function and you’re itching to use it, except you can’t. You’re stuck with R till the end of days. Or so you thought. No more! Perform this easy setup with Reticulate and Conda for your project and never make do without Python again.

This method is for you if you use the RStudio IDE (version 1.2 and up) and have Conda set up. Some basic familiarity with Terminal and the command line is required as well. Let’s get started.

Step 0: Set Up Your R Project

Go about your R business as usual. Set up your .RProject from the RStudio IDE by going to File > New Project. To demonstrate, let’s set up a new project in a project directory called my_project/. I usually have an R Markdown document to organise my analysis for each project so I create this as well: my_project.Rmd.

Now, install the Reticulate package from the console:

install.packages("reticulate")

Step 1: Set up Python with Conda

--

--

Save The Data
Save The Data

Published in Save The Data

Topics in Bioinformatics and Data Science explained intuitively for the busy professional.

Denisa Blackwood
Denisa Blackwood

Written by Denisa Blackwood

Scientist based in London. I write about tech, science, society and mental health. For collaborations, get in touch at denisa.blackwood [at]protonmail[dot]com

Responses (3)