Unit 1: Getting StaRted

In this unit, you will become familiar with the R console, RStudio, and basic actions and operations in R.

Follow the links to each lecture, lab, and reading.

Scroll down to download the SWIRL lessons.

Lesson 1. What is R?

Lecture: Overview of R, demonstration of R.

Learning Goals:

Lab: Unit 1: Lab 1

Reading: NYT article, 2009 Quartz article, 2019

Functions: None.

Lesson 2. How to use R as a calculator


Learning Goals:

SWIRL: Basic building blocks

Lab: Unit 1: Lab 2


Functions: <-, getwd(), setwd().

Lesson 3. How to work with vectors

Lecture: Types of data and data structures

Learning Goals:


Best Practice: Code style guide


Functions: c(), :, seq(), rep(), plot(), is.vector(), etc

Lesson 4. How to summarise vectors

Lecture: Using functions

Learning Goals:


Lab: Unit 1: Recap

Functions: getwd(), setwd(), sum(), mean(), sd(), summary(), length(), boxplot(), hist()


The lessons we will use are available online and you need to download them to your laptop.

  1. Open RStudio

  2. In the console panel, next to the arrow (>), copy and paste the following:

install_course_github("intro2r", "swirl_courses", multi = TRUE)

This will download the most up-to-date lessons.

To start the lesson, type


Updated 2018-08-29