R: From Basics to Expert

Base R, the tidyverse, statistics and Shiny - from your first vector to a package in production.

Taught by Noshad Alam 13 lessons 38 min Published 23 Nov 2026

R was written by statisticians for statisticians, and it shows in every design decision. There is no scalar type, because a single number is a vector of length one and statistics works on vectors. Indexing starts at 1, because that is how a table is numbered on paper. Missing data has its own value, `NA`, that propagates through arithmetic rather than being silently dropped - because in real data something is always missing, and pretending otherwise is how you publish a wrong number.

Overview

Those choices make R strange if you arrive from Python or JavaScript, and they make it extraordinarily direct once you stop fighting them. A linear model is `lm(y ~ x, data)`. A grouped summary is four lines of `dplyr` that read like a sentence. A publication-quality chart is a grammar rather than a drawing API. For the work R is for - exploring a dataset, testing whether a difference is real, and producing a document that regenerates itself when the data changes - very little else comes close.

This course is four phases. The first is base R with no packages at all: the data structures, the coercion rules, and the control flow, because the tidyverse is built on these and the errors you will meet are base R errors. The second is the modern workflow - importing data, `dplyr` and `tidyr` for wrangling, `purrr` for iteration, `stringr` and `lubridate` for the two data types that cause the most trouble, and `ggplot2`. The third is the statistics: exploratory analysis, hypothesis tests, regression, `tidymodels`, and reproducible reports in Quarto. The fourth is production: Shiny applications, R's three object systems, profiling and `Rcpp`, and the package, testing and environment tooling that turns an analysis into software. Every lesson is free to read in full.

Introduction

You do not need to have programmed before. Phase one starts at installing R and assumes nothing, and R is a reasonable first language if your reason for learning it is data - the feedback loop is short and the results are visible immediately.

You do need some comfort with the idea of a dataset: rows, columns, and the notion that a column has a type. No statistics is assumed, and the statistical topics in phase three explain what a p-value means before using one.

Install **R** from CRAN and **RStudio Desktop** from Posit. Both are free, and the first topic covers it. Everything in phases one to three runs on a laptop with no further setup; phase four adds a few packages, all installable from inside R.

One thing to know before you start, because it catches everybody. R has two ways of doing most things: base R, from 1993, and the tidyverse, from around 2014. They coexist, both are current, and tutorials mix them without saying which is which. This course teaches base R first and then the tidyverse, and says explicitly which one it is using and why - because the confusion between them is the single biggest obstacle to learning R from the internet.

What you will be able to do

  • Work confidently in RStudio, and manage packages without fighting the library path
  • Choose the right data structure, and predict what R's coercion rules will do before running the line
  • Subset anything with the right one of $, [ ] and [[ ]]
  • Import data from CSV, Excel and SQL, and know which reader to trust
  • Wrangle data with dplyr and tidyr, including grouped summaries, pivots and joins
  • Replace loops with the purrr map family, and handle text and dates without regular expression despair
  • Build a publication-quality chart in ggplot2 and say why the grammar is a grammar
  • Run and interpret a t-test, an ANOVA and a chi-square test, and say what each one assumes
  • Fit and diagnose a regression, and evaluate a model with tidymodels
  • Write a Quarto report that regenerates itself when the data changes
  • Build and deploy a Shiny application with a reactive flow you can reason about
  • Profile slow code, vectorize it, and reach for Rcpp only when the profile says so
  • Ship an R package with documentation, tests and a locked environment

What each level covers

4 levels · 13 lessons

  1. Phase 1 - Foundations of R and Base R

    The syntax, the data structures and the control flow, with no packages at all - because everything later is built on these and so are the error messages.

    3 lessons 6 min of reading

    Start with Introduction to the R Ecosystem →
  2. Phase 2 - Data Manipulation and Visualization with the Tidyverse

    The modern workflow: getting data in, reshaping it with dplyr and tidyr, replacing loops with purrr, and drawing it with ggplot2.

    4 lessons 13 min of reading

    Start with Data Import and Export →
  3. Phase 3 - Statistical Modeling and Reporting

    What R was built for: exploring a dataset, testing whether a difference is real, fitting and judging a model, and writing a document that regenerates itself.

    3 lessons 10 min of reading

    Start with Exploratory Data Analysis and Core Statistics →
  4. Phase 4 - Production, Apps and Optimization

    Turning an analysis into software: Shiny applications, R's three object systems, profiling that tells you where the time actually goes, and the packaging and environment tooling that makes it reproducible.

    3 lessons 9 min of reading

    Start with Interactive Web Apps with Shiny →

Guides and articles

Longer reading about this subject, written alongside the course.

Course guide How to work through this course What each phase is for, the four things to build alongside it, the base R and tidyverse confusion explained once, and what to skip on a first pass. 4 min read
  • NA is contagious, and it is the best decision R ever made

    Every other language treats a missing value as an inconvenience to route around. R treats it as information, and makes it spread through every calculation it touches until you say, in writing, what you want done about it. That is not an annoyance. It is the feature that stops you publishing a wrong number.

    · 9 min read

Before you start

  • R 4.2 or newer, from CRAN
  • RStudio Desktop, or Positron
  • No prior programming experience
  • Familiarity with the idea of rows and columns

Common questions

What does the R: From Basics to Expert course cover?
It is 4 levels and 13 lessons: Phase 1 - Foundations of R and Base R; Phase 2 - Data Manipulation and Visualization with the Tidyverse; Phase 3 - Statistical Modeling and Reporting; Phase 4 - Production, Apps and Optimization. Each level ends with a quiz, and the last one is an exam over the whole course.
How long does it take?
About 38 minutes of reading and exercises - roughly 0.6 hours. It is self-paced with no cohort and no start date, so you can leave and come back and the site remembers where you were.
What do I need to know first?
R 4.2 or newer, from CRAN. RStudio Desktop, or Positron. No prior programming experience. Familiarity with the idea of rows and columns.
Is it free?
Yes. Every lesson, example and quiz in this course is free to read, and you do not need an account to read them. Signing in only adds progress tracking and quiz results.
What will I be able to do afterwards?
Work confidently in RStudio, and manage packages without fighting the library path. Choose the right data structure, and predict what R's coercion rules will do before running the line. Subset anything with the right one of $, [ ] and [[ ]]. Import data from CSV, Excel and SQL, and know which reader to trust. Wrangle data with dplyr and tidyr, including grouped summaries, pivots and joins. Replace loops with the purrr map family, and handle text and dates without regular expression despair. Build a publication-quality chart in ggplot2 and say why the grammar is a grammar. Run and interpret a t-test, an ANOVA and a chi-square test, and say what each one assumes. Fit and diagnose a regression, and evaluate a model with tidymodels. Write a Quarto report that regenerates itself when the data changes. Build and deploy a Shiny application with a reactive flow you can reason about. Profile slow code, vectorize it, and reach for Rcpp only when the profile says so. Ship an R package with documentation, tests and a locked environment.