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

  1. Open RStudio.

  2. In the R console window, type the following commands to load the swirl package:

    library(swirl)
    swirl()
  3. Install the course “R Programming: The basics of programming in R”, by following the instructions provided by swirl.

    1. Enter your name.
    2. Press ENTER.
    3. Enter 1, 2, or 3.
    4. Install the course “R Programming: The basics of programming in R”.
  4. Complete your first lesson.

    1. Select “R Programming”.
    2. Select “Basic Building Blocks”, by entering 1 ( i.e. the corresponding lesson number ).
    3. Follow the instructions provided by swirl to complete your first lesson.
    4. 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

  1. Complete additional swirl lessons.
    1. Select “R Programming
    2. Compete each of the following lessons:
      • 4: Vectors
      • 5: Missing_Values
      • 6: Subsetting_Vectors
      • 12: Looking_at_Data
  2. Once you have completed all the lessons listed above, exit swirl.
    1. To exit swirl, type bye() in the R console, press ESC on your keyboard, or enter 0 in response to the swirl course menu prompt.