Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
Book · OtherFree

R for Data Science (2e)

The book most people use to learn modern R: import, tidy, transform, visualise and communicate data with the tidyverse and Quarto. Written by Hadley Wickham, Mine Çetinkaya-Rundel and Garrett Grolemund, and free to read online, it takes you from zero to a reproducible analysis.

Edition

2nd edition

r4ds.hadley.nz · Sept 2026

GitHub stars

5.2k (hadley/r4ds)

GitHub · Sept 2026

Format

Book

Topic

Other

Provider

Wickham, Çetinkaya-Rundel, Grolemund

Time needed

4 to 8 weeks at a steady pace

Level

Beginner

Access

Free

What the book is

R for Data Science, second edition, by Hadley Wickham, Mine Çetinkaya-Rundel and Garrett Grolemund, teaches you "how to get your data into R, get it into the most useful structure, transform it and visualize" it. It is built around the tidyverse, the family of R packages that most modern R code uses. The website states that it "is and will always be free", under a Creative Commons licence, and a printed copy is also sold.

What it covers

The book is organised in five parts:

  • Whole game: a fast tour of visualisation with ggplot2, transformation with dplyr, tidying, importing and a good workflow.
  • Transform: logical vectors, numbers, strings, regular expressions, factors, dates and times, missing values and joins.
  • Import: spreadsheets, databases, Arrow, hierarchical data and web scraping.
  • Program: functions, iteration and the parts of base R you still need.
  • Communicate: Quarto documents and formats for sharing your results.

Is it worth it?

If you are learning R, this is the natural first book. It teaches a consistent way of working, grammar of graphics plots and reproducible reports, instead of a pile of disconnected functions. The second edition is up to date with current tidyverse practice, including the native pipe and Quarto.

Where it fits for a data science learner

R is common in research, academia, biostatistics and many analytics teams. If your path points that way, read this before any modelling book: clean, well shaped data and clear plots are most of the work. Once you finish, tidymodels and statistical learning texts with R labs will feel familiar, because they use the same style.

Prerequisites

None beyond being comfortable on a computer. The book starts from installing R and an IDE, and explains the code as it goes. Some school level maths helps with the numbers chapters.

How much time does it take?

Most learners work through it in a month or two with regular practice. The whole game part alone gets you producing useful plots and summaries within the first week. Do the exercises; suggested answers are published on a separate solutions site linked from the book.

What you can do after it

Load messy data from files or databases, reshape it into a tidy form, clean strings, dates and factors, join tables, build clear ggplot2 charts, write your own functions and publish a reproducible Quarto report.

Common questions

Do I need the first edition? No. Read the second; it replaces the first.

R or Python? Both are fine for data science. Choose R if your field, supervisor or team uses it, and this book is the best place to start.

Is it free? Yes, the full text is online at no cost.

beginner friendlyopen source

Ready to start?

Opens on Wickham, Çetinkaya-Rundel, Grolemund in a new tab.

Open resource
Link broken or out of date?

Report a problem

With "R for Data Science (2e)". Only Tauseef reads this.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.