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

Lectures:

Learning Goals:

SWIRL: Basic building blocks

Lab: Unit 1: Lab 2

Reading:

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

Lesson 3. How to work with vectors

Lecture: Types of data and data structures

Learning Goals:

SWIRL:

Best Practice: Code style guide

Labs:

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

Lesson 4. How to summarise vectors

Lecture: Using functions

Learning Goals:

SWIRL:

Lab: Unit 1: Recap

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


SWIRL

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:

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

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

To start the lesson, type

swirl()

Updated 2018-08-29