R Language tutorials
R is a language and environment for statistical computing and graphics, created at the University of Auckland in the early 1990s as an implementation of the S language. It is interpreted, dynamically typed, and built around vectors: a whole column of numbers is passed to a function at once. R is used for statistics, data analysis, and visualisation, and CRAN hosts thousands of packages that extend it.
The examples are complete scripts run with Rscript and R 4.5.2
on Linux, and their output is shown as produced. The series uses base R first
and adds packages only when the base language has been covered.
Getting started
Installing R and packages, the first scripts, the console, command-line arguments, and the help system.
Fundamentals
Variables, data types, operators, control flow, functions, vectorization, and random numbers.
Data structures
Vectors, lists, matrices, arrays, factors, data frames, and tibbles.
Strings and dates
Strings, regular expressions, stringr, and dates and times.
Data wrangling
Subsetting, missing values, the apply family, dplyr, tidyr, and data.table.
Statistics
Descriptive statistics, distributions, hypothesis tests, correlation, regression, ANOVA, and time series.
Graphics
Base graphics, ggplot2, plot customization, and exporting plots to files.
Packages and data I/O
Packages, CSV and RDS files, Excel, JSON, SQL databases, web scraping, and HTTP APIs.
Reporting
R Markdown, Quarto, and interactive Shiny applications.
Object-oriented programming
The S3, S4, and R6 object systems.
Package development and debugging
Creating packages, debugging, and error handling.
Advanced and performance
Environments, closures, recursion, profiling, and parallel computing.
last modified November 20, 2026