Instructions For Handing In Homework

In rStudio, we have walked through the four main areas of rStudio. On the top right, there is a tab called History. Click that tab before starting a single lesson, and then click the broom. This will wipe your history. Then return to Environment and begin your lesson. When done with a single lesson, save your history.

  1. Open rStudio / Click History tab on top right.
  2. Clear history by clicking the broom.
  3. Click the Environment tab.
  4. Begin a single lesson assignment (3-4 a day).
  5. When the lesson asks if you would like to get credit, choose “No”.
  6. Instead, click History tab again.
  7. Choose the save button and save it as LastName_Day#Homework#.
  8. Return to step 1 and repeat 1-7 for each lesson.
  9. Upload each .rHistory file to Sakai.

Instructions for Homework

To start your Swirl homework, go into rStudio. In the console, ensure that the swirl package is loaded. We can do this through

library(swirl)
## 
## | Hi! Type swirl() when you are ready to begin.

If you did not install this in class for whatever reason, or you are reading ahead, we want to ensure that the package was already loaded. So, if we had some error that said something like:

Error in library(swirl) : there is no package called ‘swirl’

You want to first install swirl. Remember once it’s installed, it still needs to be called to r’s attention that we want to use it.

install.packages("swirl")
library(swirl)

We also want to ensure we have installed the courses that we will be using. You should have done this in class as well. But, in case you didn’t, we want to run the following code. In class, we will be doing our best to include as much information as possible to ourselves where our various functions come from.

You will not see this practice in swirl, but that’s okay. As we will learn, certain functions come from certain packages. swirl, for instance, created new functions for us like install.course(). While you can call this function directly with install.course(), we are going to try and ensure we always tell the reader (that’s you!) what package these things come from. We do that through the use of the double colon (::). This says "In this library on the left, look for this function on the right. Some functions are from the base r language, and so we don’t need to call out what library they’re from. That’s why install.packages() does not have the colon.

install.packages("tidyverse")
swirl::install_course("A_(very)_short_introduction_to_R")
swirl::install.course("Exploratory Data Analysis")
swirl::install_course("Getting and Cleaning Data")
swirl::install_course("R Programming")

From here, you should do what the red text tells you to do. It says type swirl() to begin.

swirl()

Once there, choose a name that you’ll remember and keeps consistent. In class, I’ve been using DrC.

## [1] "Welcome to swirl! Please sign in. If you've been here before, use the same name as you did then. If you are new, call yourself something unique."
## [1] "What should I call you?"

If you have finished all of your homework for the day, you would see something like:

## | Please choose a course, or type 0 to exit swirl.
## 1: Exploratory Data Analysis
## 2: Getting and Cleaning Data
## 3: R Programming
## 4: Take me to the swirl course repository!

If you were in the middle of a homework and didn’t finish, you might first see something like:

## | Would you like to continue with one of these lessons?
## 1: R Programming Basic Building Blocks
## 2: No. Let me start something new.

From this, you should either continue with your current lesson you were working on, or find the correct course and lesson based on the names.

Course Homework:

All homework is assigned for a given day after class, which means said day’s homework should be completed prior to the next day of class. Screenshots of the homework should be submitted on Sakai.

Monday, January 10th

Note: a(v)sitR lessons will use = instead of <-. They tell you it is the same, and it is. Just remember to be flexible when engaging in the lessons! You might work with weird people who use = (we will always use <- in class), and you want to be able to understand what they’re coding.

  • R Programming: Basic Building Blocks 1
  • R Programming: Workspace and Files
  • A (very) short introduction to R: Module 1
  • R Programming: Sequences of Numbers
  • R Programming: Vectors

Tuesday, January 11th

  • R Programming: Missing Values
  • R Programming: Subsetting Vectors
  • A (very) short introduction to R: Module 2
  • R Programming: Matrices and Data Frames
  • R Programming: Looking at Data

Wednesday, January 12th

  • Exploratory Data Analysis: Principles of Analytic Graphs
  • R Programming: Base Graphics
  • Exploratory Data Analysis Base Plotting Systems

Thursday, January 13th

  • Exploratory Data Analysis: Exploratory Graphs
  • Exploratory Data Analysis: Working With Colors

Friday, January 14th

  • Getting and Cleaning Data: Manipulating Data with dplyr
  • Getting and Cleaning Data: Grouping and Chaining with dplyr
  • Getting and Cleaning Data: Tidying Data with tidyr

Monday, January 17th

  • Exploratory Data Analysis: GGPlot2 Part1
  • Exploratory Data Analysis: GGPlot2 Part2
  • Exploratory Data Analysis: GGPlot2 Extras

Tuesday, January 18th

  • R Programming: Functions

Wednesday, January 19th

  • Lab to be turned in, created through Rmd.

Thursday, January 20th

Friday, January 21st

  • Final project to be turned in, created through .Rmd. ## Warning on Using Skip()

Since you can find all of this in the help file for swirl(), which as a reminder is doing

?swirl

These homeworks should take you less than an hour of your time. Each lesson is anywhere from 7 to 15 minutes. Some are more difficult than others. But coding is learning through failure and struggles. I hope you are in this course to learn, and that means struggling through these if you are having difficulty.

Swirl lets you know you can use skip() to skip any question that is giving you trouble. However, swirl also basically hand-feeds you the answer if you get it wrong once. As such, you will get 0% per homeowrk if you use skip() more than twice in a single homework.

Swirl will let you pause at any time by typing bye() or main() during the lesson. You can also type play() to pause the lesson and play around in r, and when you are ready to return, you type nxt()