What the world needs now: Even more R/RStudio instructional videos


You might be interested in the backstory for these two R/RStudio instructional videos I created, which gives insight into our department’s recent transition to teaching stats using R/RStudio instead of Excel/SPSS (if not, the TL;DR for this section is that these two videos were borne out of frustration, last-minute panic, and pedagogical role-modeling by my son).

Starting this 2016/7 academic year, all our statistics instruction in psychology is leaving Excel/SPSS behind and moving on to R/RStudio.  We chose R because we want our students to learn how to do make their data analyses reproducible.  The first year of our program will now be devoted to developing basic data science skills: loading in different kinds of datasets, tidying them, merging them with others, visualizing distributions, calculating basic descriptive statistics, and generating reports in RMarkdown.  We needed some kind of tutorial on interacting with R/RStudio that incoming students could work through at their own pace.

We also needed some additional training materials for our teaching staff.  We set aside a day before the start of term where we would pilot our new lab materials with students, almost none of whom had encountered R/RStudio before. The students would therefore need lots of support to get through the exercises.  But in spite of best our efforts to get teaching staff sufficiently trained up, as the pilot day approached, many were still anxious about having to help students use software they themselves were still coming to grips with.

I had developed a series of web-based step-by-step walkthrough documents for our incoming students that I sent out to some of the staff to try out, and although staff politely expressed gratitude for my efforts, I think they found it overwhelming.  Some complained that it took far too much time to get through (and, by the way, was also missing important information).  So clearly the format was not working.

While I had been working on these materials, my son had been spending his last days of summer vacation producing videogame walkthroughs (BTW, if you’re looking for cool Minecraft videos, this 11-year-old has got your back).  So 24 hours before piloting day, with staff panic approaching meltdown levels, I realized through my son’s example that the pedagogical medium I needed all along was video (DUH, Dad!).


I needed a video, and I needed it quickly.  I did not have hours to spend watching videos on YouTube to the exact one that would suit my needs, and I quickly realized that it would probably take me less time to make my own than to review the many hours of instructional videos already available, if I limited myself to one take.  After all, wasn’t Sister Ray cut in a single take?  So I thought up an analysis task, launched the video capture software, and hoped for the best.  Judge accordingly.

The staff and students were happy the result, so I decided to make the videos public.  Hopefully others will find these introductory videos useful, especially those just starting out in R.

The videos

The videos provide a demo of R/RStudio in the context of an analysis of Scottish babynames.  I had three goals:

  • Dazzle students with some R black magic so that they get excited about its possibilities, while still giving them the basics;
  • Provide a model of how to interact with R/RStudio in the context of a well-defined analysis task;
  • Choose an analysis project that would be fun and personally relevant to our incoming students.  I had been playing around with the babynames package for one of our homework assignments, and in the process had discovered that the National Records of Scotland has a similar database in CSV format.

I did the analysis twice, once as an R script and once as part of an RMarkdown report, and decided to split the video into two parts.

Video 1: Basic interaction with RStudio, developing an R script

Yes, around a minute of the first video involves me awkwardly watching the readr package installation process, wishing I knew some good R jokes or had some background music to make the time pass more quickly.

Yes, in the video I accidentally reveal that I had been recently been using R to make chickens talk.

Yes, color is probably not the best way to differentiate the names in the graphs.

Yes, at no point in the video do I appear to realize that the trends I am looking at in the videos largely reflect the statistical phenomenon of regression toward the mean, in spite of having published on this very topic.  But at least it did remind me after the fact that we need to discuss this phenomenon somewhere in our curriculum!

The R script for this analysis:

Video 2: RMarkdown and knitting an HTML report

This second part of the video reproduces the analysis in an RMarkdown document and shows how to compile an HTML report.

And the RMarkdown document (click “View Raw” at the bottom right of the window for the RMarkdown source)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s