1 Introduction
1.1 Language Agnostic Data Science
The trend of the past few years is that Data Science is becoming more language-agnostic.
Tools such as Quarto, Apache Arrow… enable working across languages with less friction.
RStudio (the company) renaming itself to “Posit” was also a clear statement of intent. Tools like Shiny and Pins are being ported to Python, and the latest exciting installment is Posit’s new language agnostic data science IDE, Positron.
We often receive questions from R users on whether we can deliver an “Introduction to Python” course, or something similar. While yes, we can certainly do that, the question really is… why?
Another aspect to this we have noticed, is that a lot of “Introduction to Python” courses are almost always aimed at complete beginners of programming full stop. Most, if not all R users know full-well what a variable or a dataframe is and how to print("Hello World!")
. These courses are not pitched at the right level.
Returning to the question of why R users might want to learn Python, the answer is that there could be a plethora of reasons. But sometimes, simply being able to use R in combination with Python could be enough to achieve your aims.
In other scenarios, you will need to learn some Python, but a quick crash course on the differences between R and Python and the particular topic you’re interested in could be enough.
This book aims to provide some guidance on where R and Python are different, but also show the ever-increasing range of methods to combine the two languages together. This book is split in two major sections, Python for the R user and Using R and Python together.
1.2 Python for the R user
This chapter attempts to minimally break down the differences between R and Python, written for the R user.
Topics:
- matplotlib, instead of ggplot2
- numpy, instead of dplyr
1.3 Using R and Python together
This chapter outlines the range of tools available to implement R and Python together, and allow you to collaborate with Python users, without actually learning much Python.
Topics:
- Language bridges: reticulate / rpy2
- Quarto: language agnostic publishing
- Web Applications: Shiny for R / Shiny for Python
- In Production: Shell execution
- In Production: Managing environments