R Tutorial

Tidyverse

The modern data science ecosystem for R

What is the Tidyverse?

The Tidyverse is an opinionated collection of R packages designed for data science. All packages share an underlying design philosophy, grammar, and data structures. It was pioneered by Hadley Wickham.
r
install.packages("tidyverse")
library(tidyverse)

The Core Packages

PackagePurpose
ggplot2Creating data visualizations
dplyrData manipulation (Filtering, Grouping, Calculating)
tidyrChanging data shape (Pivoting)
readrFast data import
purrrFunctional programming toolset
tibbleModern version of the data frame
stringrEasier string manipulation
forcatsEasier factor (categorical) manipulation

The Pipe Operator (%>% or |>)

Wait! This is the most famous feature of the Tidyverse. The Pipe allows you to chain multiple operations together. It takes the output of one function and "pipes" it as the first argument to the next.
r
# Instead of f(g(x, y), z)
# You write:
x %>% g(y) %>% f(z)

Why use Tidyverse?

  1. Readability: Code reads like a sequence of actions (English verbs).
  2. Consistency: Once you learn one package, the others feel familiar.
  3. Speed: It is highly optimized for modern data science tasks.

Summary

TermDescription
Tidy DataEvery variable is a column, every observation is a row
Pipe%>% (magrittr) or `
TibbleA data frame with better printing and behavior
Hadley WickhamThe "Godfather" of the Tidyverse
Best ForModern, clean, and professional data science code
Logic"Functional, human-readable pipelines"
SafetyClear error messages and predictable results
ModernThe industry standard way to write R today
StandardMost modern R tutorials and books use the Tidyverse
IdentityThe reason why R remains competitive with Python for data science