Python for R Programmers

A One-Week Workshop for R Users Learning Python

Author

The rgtlab Curriculum Project

Published

2026-07-29

Welcome

This is the online version of Python for R Programmers: A One-Week Workshop for R Users Learning Python by The rgtlab Curriculum Project, a short workshop for statisticians and data analysts who are already fluent in R and want to become productive in Python.

The book covers what a working R user needs in order to read, write, and run everyday scientific Python: the Python mental model and how it differs from R; the core data structures and control flow; NumPy and pandas for numerical and tabular work; the visualization and modeling stack; and reproducible project structure with interoperability back to R. It is designed for five consecutive days of work: roughly one hour of lecture content each day, two hours of homework, no examinations.

The organizing principle is translation. We assume the reader knows the R idiom already, so every Python construct is introduced by contrast with its R counterpart. That is, we do not teach programming from scratch; we teach a second language to a reader who already thinks in a first one. Every chapter opens with an R idiom the reader knows, develops the Python equivalent, and returns to compare what each language makes easy and what each makes awkward.

This workshop is a companion to a broader curriculum series:

A reader who completes R for Biostatistics has the R fluency this workshop assumes; a reader who completes this workshop can move between the two languages as a given problem demands.

See the Preface for the design rationale and the Conventions page for visual cues.

License

This book is licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International.

Code samples are licensed under Creative Commons CC0 1.0 Universal, i.e. public domain.