Skip to content
Pebellslearn by building

The course

R Programming

Learn the core of R, the language statisticians built for working with data. You install R, then learn its syntax, types, vectors, lists, data frames and functions on one small community-garden harvest log, so every idea builds on the last.

Ready to learn

Your path through the ideas

Inside the course

6 modules · 23 lessons
CLI tools & setup · Start here

Install your tools, choose your setup and verify a local run.

02Introduction and Setup5 lessons

R is a language and environment for statistical computing, data analysis and graphics. Packages extend its built-in tools. See where R fits next to Python, install R and an editor, write and run a first script, add packages from CRAN, and pin a project's package versions with renv so it runs the same anywhere.

  1. 01R vs Python — Picking the Right Tool10 min
  2. 02Installing R and Choosing an Editor10 min
  3. 03Your First R Script12 min
  4. 04Installing Packages from CRAN10 min
  5. 05renv — A Private Library per Project14 min
03Basic Syntax5 lessons

Syntax is the grammar of R expressions: assigning values, combining operations, selecting branches and repeating work. Name values with the assignment arrow, compute on whole vectors with R's operators, chain steps with the native pipe, make decisions with if and ifelse(), and repeat work with for and while loops.

  1. 01Creating Variables10 min
  2. 02Operators — Arithmetic, Comparison and Logic12 min
  3. 03The Pipe — Reading Code Left to Right10 min
  4. 04if, else and ifelse()12 min
  5. 05Loops — for, while and repeat14 min
04Data Types4 lessons

A data type describes the kind of elements stored in an R value and how operations handle them, including missing values. Meet R's basic types: doubles, integers and complex numbers, character text, and logical values with NA for the unknown. Then learn the coercion ladder R climbs when types mix, and how to convert on purpose.

  1. 01Numbers — Double, Integer and Complex12 min
  2. 02Character — Working with Text12 min
  3. 03Logical — TRUE, FALSE and NA12 min
  4. 04Type Conversion — as.*() and Coercion14 min
05Data Structures5 lessons

R data structures organize values as vectors, lists, arrays, categories or rectangular tables. Store the harvest log in each of R's core structures: vectors with 1-based indexing and recycling, lists for mixed items, matrices and arrays for grids, factors for categories, and data frames, tibbles and data.table for tables.

  1. 01Vectors — Indexing and Recycling12 min
  2. 02Lists — Containers for Mixed Things12 min
  3. 03Matrices and Arrays12 min
  4. 04Factors — Categories with Levels12 min
  5. 05Data Frames, Tibbles and data.table15 min
06Functions4 lessons

A function is a reusable computation with arguments and a result. Its enclosing environment influences how it resolves names. Package code as functions with arguments and defaults, learn where R looks up a name, solve self-similar problems with recursion, and replace loops with lapply, sapply, vapply, apply and tapply.

  1. 01Writing Functions — Arguments and Defaults12 min
  2. 02Scope — Where R Looks Up a Name12 min
  3. 03Recursion — Functions that Call Themselves12 min
  4. 04The apply Family15 min
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.