E-Books

Six open textbooks on R, data wrangling, ggplot2, base R visualization, SQL and Bash. Read free online, or download the PDF and ePub of each.

Six open textbooks, free to read online. Written with bookdown and hosted on Rsquared Academy. Every title can also be downloaded as a PDF or ePub.

Core 01

Introduction to R

Install R & RStudio, variables, data types, packages, getting help — zero to running code.

Beginner13 chapters

No prerequisites. Start here.

What’s inside

13 chapters, from the book’s table of contents

  • Introduction to R
  • Install R & RStudio
  • Variables in R
  • Data Types in R
  • Getting Help in R
  • Vectors in R
  • Dataframes in R
  • Factors in R
  • Lists in R
  • Install & Update R Packages
  • RStudio Projects & Data Import
  • Your First Visualization
  • Your First Data Wrangling

Core 02

Data Wrangling with R

Import flat files and Excel, reshape with tidyr, clean with dplyr, pipes, tibbles, stringr, lubridate, forcats.

BeginnerIntermediate13 chapters

Prereq: Core 01 Introduction to R.

What’s inside

13 chapters, plus solutions and 3 appendices

  • Import Data — Basics
  • Import Data — Advanced
  • Pipe Operator
  • dplyr Basics
  • Joining Tables using dplyr
  • dplyr Helpers
  • tibbles
  • Tidying Data with tidyr
  • Hacking Strings
  • Date & Time: Parsing and Components
  • Date & Time: Arithmetic and Time Zones
  • Categorical Data Fundamentals
  • Factor Manipulation with forcats

Also: Exercise Solutions · Appendix A Arrow, Parquet and DuckDB · B Legacy magrittr Operators · C From pandas to dplyr

Core 03

Data Visualization with ggplot2

Grammar of graphics, geoms, scales, facets, themes, position and stats tuning, publication polish.

Intermediate22 chapters

Prereq: Core 01 + Core 02.

What’s inside

22 chapters, plus a recipe cheat sheet

  • Quick Tour
  • Geoms
  • Aesthetics
  • Labels
  • Text Annotations
  • Scatter Plots
  • Line Graphs
  • Bar Plots
  • Box Plots
  • Histograms
  • Modify Axis
  • Modify Legend
  • Legend: Color and Fill
  • Legend: Shape Size and Alpha
  • Faceting
  • Themes
  • Position & Stats Tuning
  • Scales, Formatting & Color Accessibility
  • Data Reshaping for ggplot2
  • Label Polishing & Wrapping
  • Finale: Publication Polish with patchwork, ggrepel & ggtext
  • Export & Communicate

Also: chapter 23 Modern Recipe Cheat Sheet.

Core 04

R, Databases & SQL

Connect R to databases with DBI, translate dplyr into SQL, write joins and production-grade queries.

Intermediate5 chapters

Prereq: Core 02. Already querying in SQL? Take 04 straight after 02.

What’s inside

5 chapters, plus a cheat sheet and 2 appendices

  • DBI
  • dbplyr
  • SQL Basics
  • SQL Advanced
  • JOINs

Also: chapter 6 DBI Cheat Sheet · Appendix A Production R Patterns · B DuckDB + Parquet.

Companion A

Command Line Basics

Files, permissions, pipes and scripting — enough shell for R users.

Beginner12 chapters

No prerequisites. Take alongside Core 01.

What’s inside

12 chapters, plus a shell cheat sheet and a Git primer

  • Introduction
  • Navigating File System
  • File Management
  • Input/Output
  • Search & Regular Expression
  • Data Transfer
  • sudo
  • File Compression
  • System Info
  • R & the Shell
  • Pipes & Redirection
  • Conclusion

Also: chapter 13 Shell ↔︎ R Cheat Sheet · chapter 14 Git in 10 Minutes for RStudio Users.

Companion B

Data Visualization with Base R

The base graphics engine: parameters, multi-panel layouts and production export. Zero dependencies.

Intermediate12 chapters

After Core 03, if you need fine-grained canvas control. Requires R 4.1+.

What’s inside

12 chapters, plus a Rosetta Stone appendix

  • Why Base R Graphics in 2026?
  • Introduction
  • Title & Axis Labels
  • Scatter Plots
  • Line Graphs
  • Bar Plots
  • Box Plots
  • Histograms
  • Legends
  • Text Annotations
  • Faceting
  • Production Export & Graphical Devices

Also: Appendix A Base R ↔︎ ggplot2 — a Rosetta Stone · References.

Learning path

The Core Track is designed to be followed end to end. The two companions slot in alongside it rather than after it.

Core 01

Intro to R

BeginnerZero to running code. RStudio, packages, help.

Core 02

Data Wrangling

BeginnerImport, reshape, dplyr, pipes, tibbles.

Core 03

Viz with ggplot2

IntermediateGrammar of graphics through to publication polish.

Core 04

R, Databases & SQL

IntermediateDBI, dbplyr, queries, joins.

Shortcut: already wrangling data in SQL? Take 04 straight after 02.

Companion A — Foundational Tooling

Command Line Basics

BeginnerFiles, permissions, pipes and scripting for R users. Pair with Core 01.

On Windows: everything works from the RStudio Terminal, Git Bash or WSL — chapter 1 covers all three.

Companion B — Graphics Deep-Dive

Data Viz with Base R

IntermediateBase graphics engine, parameters, multi-panel layouts, production export. Zero dependencies. After Core 03.

Series at a glance

Six titles in the order they are meant to be read.

Cover: Introduction to R

01 Intro - Introduction to R

Cover: Data Wrangling with R

02 Wrangle - Data Wrangling with R

Cover: Data Visualization with ggplot2

03 ggplot2 - Data Visualization with ggplot2

Cover: R, Databases and SQL

04 SQL - R, Databases and SQL

Cover: Command Line Basics

C-A Bash - Command Line Basics

Cover: Data Visualization with Base R

C-B Base - Data Visualization with Base R

If you are starting from zero, begin with Introduction to R. The full catalogue, with download links for every title, is also at ebooks.rsquaredacademy.com.

License

All six books are open educational resources under CC BY-NC-SA 4.0 — free to read online and to share with attribution, non-commercially. Found a typo? Open an issue on the book’s GitHub repository.