In these lessons, you will learn the basics of interacting with R through RStudio and the command line.
Each section includes a lecture, a lesson, and a lab.
The lecture provides background material, theory, or how-to for the lesson. The lecture will be given as a slide presentation in class. Annotated slides will also be put up on this site.
The lesson is done in real time in RStudio. You will use SWIRL (see below) to interact directly with R in the console. SWIRL allows us to evaluate you R code as you write it and give immediate feedback. Completion of each lesson is required. See How to: SWIRL for more details. For future reference, the lessons are also presented as a separate webpage.
The labs are designed to test the skills and knowledge you learnt in the lesson. They consist of a series of questions that require you to write R code to answer. These answers are submitted and graded on Canvas. Please scroll down to How to: Labs for more details.
Lecture: An Overview of R slides | webpage
Lecture: A First Look
Lecture: How to Use SWIRL
Lecture: How Computers Work | Lesson | Lab
Lecture: Types of Data in R | Lesson | Lab
Lecture: The Importance of Missing Data | Lesson | Lab
Lecture: Subsetting | Lesson | Lab
Lecture: Matrices and Data Frames | Lesson | Lab
Best Practice: Data Management
Lecture: Entering Data
Lecture: Functions and Lists | Lesson | Lab
lesson | lab |
Lecture: Split-Apply-Combine: the apply set of functions
Lesson | No lab
Lecture: Time Management
Labs test the skills and knowledge taught in the lessons.
You are required to answer a set of questions, often related to real data.
Please submit your R code on Canvas.
You will need to write R code to answer each of the questions.
Please format your answers as follows:
Copy and paste each question, commented out. This ensures that we know which answer corresponds to which question.
Write your R code answer below each question.
It should look something like this:
# LAB: Basic Building Blocks
# Simon Queenborough
# 1. What year was the first Harry Potter movie released?
2001
# 2. Assign this value to an object
x <- 2001
You are permitted to submit your answers as many times as you like within 2 weeks.
Answers will be graded two or three times a week and re-opened if you do not score 100%.
Each lab will close after 2 weeks and final grades for that lab computed and entered into the Canvas gradebook.
To submit your answers on Canvas
Log into Canvas.
Go to the Assignments page.
Under ‘Labs’, you should find the Basic Building Blocks assignment.
Copy and paste your R code into the text box.
Click ‘Submit Assignment’.
Updated: 2017-09-07