Python for R Programmers
A One-Week Boot Camp for R Users Learning Python
Welcome

This is the online version of Python for R Programmers: A One-Week Boot Camp for R Users Learning Python by The rgtlab Curriculum Project. We have written it for statisticians and data analysts who are already fluent in R and want to become productive in Python.
We begin from 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. The book is designed for five consecutive days of work, roughly one hour of lecture content each day and two hours of homework, with no examinations.
The organizing principle is translation. We assume the reader already knows the R idiom, so we introduce every Python construct 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. Each 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:
- R for Biostatistics: A One-Week Boot Camp (https://r-bootcamp.rgtlab.org), the preparatory volume for the R language this workshop assumes.
- Git and GitHub for Biostatistics: A One-Week Boot Camp (https://git-bootcamp.rgtlab.org), the parallel preparatory volume for version control.
- Statistical Computing in the Age of AI, introductory methods (linear models, GLM, mixed models, survival, Bayesian, bootstrap, simulation).
- Applied Generative AI for Health Sciences Research, capability classes, RAG, agents, evaluation, regulation, deployment.
A reader who has completed R for Biostatistics has the R fluency this workshop assumes. A reader who completes this workshop should be able to move between the two languages as a given problem demands.
The reader is referred to the Preface for the design rationale and to the Conventions page for the visual cues used throughout.
The Contents page lists every chapter on one page.
License
This book is licensed under Creative Commons Attribution 4.0 International.
The code samples printed in this book are licensed under the MIT License. The repository code (package functions and build scripts) is licensed under GPL-3.