Books for learning R

This post is a focused collection of free books for learning R, covering topics for new and advanced users. I will try to keep it updated as I come across new resources. If there are any resources you think I should add, please leave a comment below or DM me on Twitter. A more comprehensive collection of R books can be found in the Big Book of R.

Table of Contents

Essential Reading

Hands-On Programming with R

This book will teach you how to program in R, with hands-on examples. It was written for non-programmers to provide a friendly introduction to the R language. You’ll learn how to load data, assemble and disassemble data objects, navigate R’s environment system, write your own functions, and use all of R’s programming tools. Throughout the book, you’ll use your newfound skills to solve practical data science problems.

R for Data Science

This book will teach you how to do data science with R: You’ll learn how to get your data into R, get it into the most useful structure, transform it, visualise it and model it. In this book, you will find a practicum of skills for data science. Just as a chemist learns how to clean test tubes and stock a lab, you’ll learn how to clean data and draw plots—and many other things besides. These are the skills that allow data science to happen, and here you will find the best practices for doing each of these things with R. You’ll learn how to use the grammar of graphics, literate programming, and reproducible research to save time. You’ll also learn how to manage cognitive resources to facilitate discoveries when wrangling, visualising, and exploring data.

R Markdown: The Definitive Guide

This book consists of four parts. Part I covers the basics: Chapter 1 introduces how to install the relevant packages, and Chapter 2 is an overview of R Markdown, including the possible output formats, the Markdown syntax, the R code chunk syntax, and how to use other languages in R Markdown. Part II is the detailed documentation of built-in output formats in the rmarkdown package, including document formats and presentation formats. Part III lists about ten R Markdown extensions that enable you to build different applications or generate output documents with different styles. Part IV covers other topics about R Markdown, and some of them are advanced. Note that this book is intended to be a guide instead of the comprehensive documentation of all topics related to R Markdown.

Advanced R

This book is designed primarily for R users who want to improve their programming skills and understanding of the language. It should also be useful for programmers coming to R from other languages, as it helps you to understand why R works the way it does.

R Packages

Packages are the fundamental units of reproducible R code. They include reusable R functions, the documentation that describes how to use them, and sample data. In this book you’ll learn how to turn your code into packages that others can easily download and use. Writing a package can seem overwhelming at first. So start with the basics and improve it over time. It doesn’t matter if your first version isn’t perfect as long as the next version is better.

Data Science

YaRrr! The Pirate’s Guide to R

The purpose of this book is to help you learn R from the ground-up, and to introduce you to the basic analytical tools in R, from basic coding and analyses, to data wrangling, plotting, and statistical inference. While this book was originally written for pirates, anyone who wants to learn R can benefit from this book. While the techniques in this book apply to most data analysis problems, it is catered to solving analysis problems commonly faced in psychological research.

R for Psych

In this book you will learn how to use R for data analysis and presentation. This book has a particular focus on using R for psychology (hence the name), but it should be applicable to most cases in the social sciences. The book primarily takes a tidyverse first approach to R, but still covers some of the base R functions and the basics of programming. Along the way, the book looks into how R encourages open and reproducible science, and how R can be useful for managing your research projects as a whole.


STAT 545: Data wrangling, exploration, and analysis with R

This site is about everything that comes up during data analysis except for statistical modelling and inference. This might strike you as strange, given R’s statistical roots. First, let me assure you we believe that modelling and inference are important. But the world already offers a lot of great resources for doing statistics with R. The design of STAT 545 was motivated by the need to provide more balance in applied statistical training. Data analysts spend a considerable amount of time on project organization, data cleaning and preparation, and communication. These activities can have a profound effect on the quality and credibility of an analysis. Yet these skills are rarely taught, despite how important and necessary they are. STAT 545 aims to address this gap.

Learning statistics with R: A tutorial for psychology students and other beginners

Learning Statistics with R covers the contents of an introductory statistics class, as typically taught to undergraduate psychology students, focusing on the use of the R statistical software. The book discusses how to get started in R as well as giving an introduction to data manipulation and writing scripts. From a statistical perspective, the book discusses descriptive statistics and graphing first, followed by chapters on probability theory, sampling and estimation, and null hypothesis testing. After introducing the theory, the book covers the analysis of contingency tables, t-tests, ANOVAs and regression. Bayesian statistics are covered at the end of the book.

R Markdown

R Markdown Cookbook

This book is designed to provide a range of examples on how to extend the functionality of your R Markdown documents. As a cookbook, this guide is recommended to new and intermediate R Markdown users who desire to enhance the efficiency of using R Markdown and also explore the power of R Markdown.

bookdown: Authoring Books and Technical Documents with R Markdown

This short book introduces an R package, bookdown, to change your workflow of writing books. It should be technically easy to write a book, visually pleasant to view the book, fun to interact with the book, convenient to navigate through the book, straightforward for readers to contribute or leave feedback to the book author(s), and more importantly, authors should not always be distracted by typesetting details.

papaja: Reproducible APA manuscripts with R Markdown

This book is a manual for the R package papaja. In this book you will learn how to create APA manuscripts, class papers, etc., in RStudio using R Markdown. This book focuses on writing in R Markdown (i.e., text formatting, citations, equations, cross-referencing, and appendices), and reporting data in R Markdown (numerical values, figures, tables, results from statistical tests). By the end of the book you will be able to create a reproducible APA manuscript which you can submit to academic journals, or submit for class assignments.

R Shiny

Mastering Shiny

This book complements Shiny’s online documentation and is intended to help app authors develop a deeper understanding of Shiny. After reading this book, you’ll be able to write apps that have more customized UI, more maintainable code, and better performance and scalability.

Version Control

Happy Git and GitHub for the useR

In this book you will learn how to: (1) Install Git and get it working smoothly with GitHub, in the shell and in the RStudio IDE; (2) Develop a few key workflows that cover your most common tasks; (3) Integrate Git and GitHub into your daily work with R and R Markdown. The target reader is someone who uses R for data science. The use of Git/GitHub in data science has a slightly different vibe from that of pure software develoment, due to differences in the user’s context and objective. Happy Git aims to complement existing, general Git resources by highlighting the most rewarding usage patterns for data science.

Michael McCarthy
Michael McCarthy
Researcher, Data Scientist, Musician

Thank you for visiting my site! If you enjoyed this content, thought it was interesting, or found it helpful, you can keep up to date with my work by following me on Twitter or GitHub, or by subscribing to any of the RSS feeds on the homepage. You can support my work by sharing it with others, or by making a donation.

comments powered by Disqus