Morris Lab

R tutorials

We do statistical analysis of our data using R, or more formally The R project for statistical computing.

R is not just a a statistics application, but a full-fledged programming language. R allows users to add additional functionality by defining new functions. You should think of R as an environment within which statistical techniques are implemented. R can be extended via packages. There are about eight packages supplied with the R distribution and many more are available through the CRAN family of Internet sites covering a very wide range of modern statistics.

RStudio is a free, open source IDE (integrated development environment) for R. (You must install R before you can install RStudio.) Its interface is organized so that the user can clearly view graphs, data tables, R code, and output all at the same time. It allows users to import CSV, Excel, SAS (.sas7bdat), SPSS (.sav), and Stata (*.dta) files into R without having to write the code to do so.

Learn more about R using these books and tutorials

Introductory Texts

R for Non-Programmers: A Guide for Social Scientists by Daniel Dauber

This introductory textbook does not assume or expect any prior knowledge or skills in programming or statistical analysis. Instead, this book offers a comprehensive entry to R programming for novices and more experienced analysts wishing to migrate from other computational software.

Modern Data Science with R by Benjamin S. Baumer, Daniel T. Kaplan, and Nicholas J. Horton

A comprehensive data science textbook for undergraduates that incorporates statistical and computational thinking to solve real-world problems with data.

Statistical Inference via Data Science: A ModernDive into R and the Tidyverse by Chester Ismay and Albert Y. Kim

In this book, students gain experience with the whole data analysis pipeline. In particular, ModernDive is one of the few intro stats textbooks that teaches students how to wrangle data. ModernDive carefully walks the students through each new function it presents and provides frequent reinforcement through the many Learning checks dispersed throughout the chapters.

Data Analysis and Processing with R based on IBIS data by Kevin Donovan

Donovan notes that much of the and content and structure of these tutorials will be based on Hadley Wickham’s excellent book R for Data Science. For those who want more detail and some exercises for the techniques detailed here, he recommmends going through Wickham’s book (see link in “Advanced Texts” below).

Data Science in R: A Gentle Introduction by James Scott

This book assumes no knowledge of R. It is structured as a series of walk-through lessons that cover both the core ideas of data science as well as the concrete software skills that will help translate those ideas into practice.

R Software Handbook

This is an R handbook for ESM (Evaluation, Statistics, and Methodology) students prepared by faculty at the University of Tennessee, Knoxville. This handbook takes students from installation and set up, to data cleaning, analysis, visualization, and reporting. This guide uses survey data from the RStudio Learning R Survey. It also includes data from built-in R data sets and simulated data.

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

In early 2011, Danielle Navarro started teaching an introductory statistics class for psychology students offered at the University of Adelaide, using the R statistical package as the primary tool. The lecture notes for the class were expanded into a book which is freely available, and as of version 0.6 it is released under a creative commons licence (CC BY-SA 4.0)

Advanced Texts

Advanced R by Hadley Wickham

Advanced R Solutions This is the website for “Advanced R Solutions” which provides solutions to the exercises from Hadley Wickham’s Advanced R, 2nd edition.

R for Data Science by Hadley Wickham & Garrett Grolemund

R in Action by Robert Kabacoff

R in Action v.2 by Robert Kabacoff

An Introduction to Bayesian Data Analysis for Cognitive Science by Bruno Nicenboim, Daniel Schad, and Shravan Vasishth

Efficient R programming by Colin Gillespie, Robin Lovelace

Linear Mixed Models in Linguistics and Psychology: A Comprehensive Introduction by Shravan Vasishth, Daniel Schad, Audrey Bürki, Reinhold Kliegl


R Graphics Cookbook, 2nd edition by Winston Chang

The R Graphics Cookbook is a practical guide that provides more than 150 recipes to help you generate high-quality graphs quickly, without having to comb through all the details of R’s graphing systems. Each recipe tackles a specific problem with a solution you can apply to your own project, and includes a discussion of how and why the recipe works.

Plotting means and error bars in ggplot2()

Plotting with colour in ggplot2 from

Plotting with colour in ggplot2 from

Principle Components Analysis in R

Principal component analysis, or PCA, is a dimensionality-reduction method that is often used to reduce the dimensionality of large data sets, by transforming a large set of variables into a smaller one that still contains most of the information in the large set.

A Step-by-Step Explanation of Principal Component Analysis

R in Action: Chapter 14 Principle Components and Factor Analysis by Robert Kabacoff

Blogdown and R Markdown

We use the an R package called blogdown to create our website. Blogdown creates web content using either Markdown or RMarkdown


Quarto is a multi-language, next generation version of R Markdown. Like R Markdown, Quarto uses knitr to execute R code, and is therefore able to render most existing .Rmd files without modification.

Comprehensive guide to using Quarto