The Tidynomicon

A Brief Introduction to R for Python Programmers

"Speak not to me of madness, you who count from zero."

Introduction

Years ago, Patrick Burns wrote The R Inferno, a guide to R for those who think they are in hell. Upon first encountering the language after two decades of using Python, I thought Burns was an optimist—after all, hell has rules.

I have since realized that R does too, and that they are no more confusing or contradictory than those of other programming languages. They only appear so because R draws on a tradition unfamiliar to those of us raised with derivatives of C. Counting from one, copying data rather than modifying it, lazy evaluation: to quote the other bard, these are not mad, just differently sane.

Welcome, then, to a universe where the strange will become familiar, and everything familiar, strange. Welcome, thrice welcome, to R.

Contributing

Contributions of all kinds are very welcome: please see this page for how to help, and our Code of Conduct for our community standards.

Setting Up

  1. Create an account on rstudio.cloud, then create a new project and start typing.
  2. Alternatively:
    1. Install R. We recommend that you do not use conda, Brew, or other platform-specific package managers to do this, as they sometimes only install part of what you need.
    2. Install RStudio.
    3. In the RStudio console, run install.packages("tidyverse") to install the tidyverse libraries. We will install others as we go along, but we’re going to need this soon.

Who You Are

Padma, 27, has been building performance dashboards for a logistics company using Django and D3. The company has just hired some data scientists who use R, and who would like to rebuild some of those dashboards in Shiny. Padma isn’t a statistician, but she’s comfortable doing linear regression and basic time series analysis on web traffic, and would like to learn enough about R to tidy up the analysts’ code and get it into production.

Derived constraints:

Learner questions: