Chapter 3 R Programming with swirl
This exercise will have you utilize an R tutorial package called swirl
, which will allow you to learn R from within R. Using swirl
, you will complete a series of lessons that will teach you the fundamentals of R programming.
3.1 Complete your first swirl
lesson
Estimated time: 20 min
Open RStudio.
In the R console window, type the following commands to load the swirl package:
library(swirl) swirl()
Install the course “R Programming: The basics of programming in R”, by following the instructions provided by swirl.
- Enter your name.
- Press
ENTER
. - Enter
1
,2
, or3
. - Install the course “R Programming: The basics of programming in R”.
Complete your first lesson.
- Select “R Programming”.
- Select “Basic Building Blocks”, by entering
1
( i.e. the corresponding lesson number ). - Follow the instructions provided by swirl to complete your first lesson.
- At the end, when swirl asks if you would like to receive Coursera credit, select “No”.
3.2 Complete additional swirl
lessons
Estimated time: 80 min
- Complete additional swirl lessons.
- Select “R Programming”
- Compete each of the following lessons:
- 4: Vectors
- 5: Missing_Values
- 6: Subsetting_Vectors
- 12: Looking_at_Data
- Once you have completed all the lessons listed above, exit swirl.
- To exit swirl, type
bye()
in the R console, pressESC
on your keyboard, or enter0
in response to the swirl course menu prompt.
- To exit swirl, type