![Gif showing the Swirl package being started from a terminal window.](/post/2019-11-02-tidyswirl-a-tidyverse-swirl-course_files/tidyswirl.gif)
Starting Swirl and selecting the tidyverse course
tl;dr
Contribute to Tidyswirl: a Swirl course that lets people learn the tidyverse from within R.
Swirl
Swirl is a framework for learning R from within R itself. You can install it with install.packages("swirl")
. Swirl courses can be created by anyone and installed from nearly anywhere, though the Swirl course repository is the ‘official’ source.
I’ve written before about how the {swirlify} package makes it easier to create Swirl packages.
Tidyswirl
I didn’t talk much in my previous Swirl post about a course I started to develop on GitHub: Tidyswirl. Its purpose is to teach the packages of the tidyverse.
![A yellow post-it note with a design for a hexagonal sticker with 'tidyswirl' written on it, surrounded by small swirly shapes of different colours.](/post/2019-11-02-tidyswirl-a-tidyverse-swirl-course_files/tidyswirl.jpg)
Ripping off the tidyverse logo, of course
At the time of publication, there are two useable lessons in Tidyswirl: one for {tibble} and one for {tidyr}. I’ve updated these to correct some errors and to improve the experience. In particular, I’ve updated the gather()
and spread()
functions to pivot_longer()
and pivot_wider()
, given the update in {tidyr} 1.0.0.
I started with these packages because of the relatively limited number of functions compared to other packages and because they’re involved typically in the early stages of a data analysis workflow.
Try it by installing Swirl and Tidyswirl:
# Install Swirl
install.packages("swirl")
library(swirl)
# Install the Tidyswirl course
install_course_github("matt-dray", "tidyswirl")
# Start Swirl
# Tidyswirl will be one of the course options
swirl()
Lesson format
For each lesson, the focal package is introduced and its roles and relationships in a tidyverse workflow are explained.
Selected functions are introduced and explained in conceptual groups, before test questions are asked to let the learner try it out and test their understanding.
Lessons end with a reminder of the package’s purpose and with links to useful external materials.
You can take a look at the lesson files for the {tibble} and {tidyr} lessons as examples, though I’ve also added a template lesson too.
Help!
Tidyswirl is unlikely to be finished anytime soon but it seems worth letting people know it exists. It’d be great for you to contribute to a lesson – which includes writing a new one for any of the other tidyverse packages – or report any issues or bugs you find when using it.