Pebellslearn by building
RoadmapsMatrixCoursesSandboxSign in

Course details

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 learn5 sections · 23 lessons
Start learning

Course curriculum

Introduction and Setup5 lessons

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. R vs Python — Picking the Right Tool10 min
  2. Installing R and Choosing an Editor10 min
  3. Your First R Script12 min
  4. Installing Packages from CRAN10 min
  5. renv — A Private Library per Project14 min
Basic Syntax5 lessons

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. Creating Variables10 min
  2. Operators — Arithmetic, Comparison and Logic12 min
  3. The Pipe — Reading Code Left to Right10 min
  4. if, else and ifelse()12 min
  5. Loops — for, while and repeat14 min
Data Types4 lessons

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. Numbers — Double, Integer and Complex12 min
  2. Character — Working with Text12 min
  3. Logical — TRUE, FALSE and NA12 min
  4. Type Conversion — as.*() and Coercion14 min
Data Structures5 lessons

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. Vectors — Indexing and Recycling12 min
  2. Lists — Containers for Mixed Things12 min
  3. Matrices and Arrays12 min
  4. Factors — Categories with Levels12 min
  5. Data Frames, Tibbles and data.table15 min
Functions4 lessons

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. Writing Functions — Arguments and Defaults12 min
  2. Scope — Where R Looks Up a Name12 min
  3. Recursion — Functions that Call Themselves12 min
  4. The apply Family15 min