Learning R with Hockey Data in Swirl

By Meghan Hall in R

March 15, 2020

The swirl package is an incredibly neat learning tool that teaches you how to use R via interactive learning in the RStudio console. And an associated package called swirlify allows anyone to create lessons that can then be used by anyone using swirl.

I've created a course called Hockey Data With Swirl that aims to teach you basic tidyverse functions using hockey data. The data set used in the swirl lesson is the same one used in my introduction to R at Hockey-Graphs, and the content is similar, but not quite identical. You can go through either tutorial, or both, in any order. The swirl package is just another learning tool that guides you through, question by question. Right now there is only one lesson in the course, but my goal is to add more in the future (such as a lesson for ggplot2!).

In order to go through the lesson, you need to have downloaded R and RStudio (the instructions for which are available in the Hockey-Graphs tutorial I linked above). In RStudio, open a script and run the following code:

install.packages("swirl")
library(swirl)
install_course_github("meghall06", "Hockey_Data_With_Swirl")
swirl()

The console prompts will take over from there. swirl works through the console, which allows for interactivity but doesn't make it easy to save your code and go back to it later. I've attempted to account for that by making available the code file that contains all of the questions and answers from the lesson.

I hope you find the lesson useful, feel free to give feedback and let me know what other topics you'd be interested in!

Posted on:
March 15, 2020
Length:
2 minute read, 265 words
Categories:
R
See Also: