About

A brief (and probably inaccurate) history of the RStudio/Posit Primers

In 2018, Garrett Grolemund (co-author of R for Data Science) created the RStudio Primers—a set of free interactive {learnr} apps to teach R to the public. These were hosted on a Shiny server maintained by RStudio and accessible through RStudio.cloud.

With RStudio’s rebranding to Posit in 2022, the lessons became the Posit Primers and remained accessible through Posit.cloud.

In December 2023, the Posit Primers were retired in favor of Posit Recipes and Posit Cheatsheets. These newer resources have been updated to the latest versions of {tidyverse} packages, and they’re no longer interactive (which is probably a lot easier for Posit’s education team to maintain).

How I’ve used the Primers in the past

I’ve been relying on the RStudio/Posit Primers for teaching my own R-focused classes since 2020. In the first few weeks of every semester, I had students complete a bunch of the tutorials to get the hang of {dplyr} and {ggplot2}.

With the sunsetting of the Primers at the beginning of 2024, though, I had to figure out a new solution.

Fortunately, the RStudio/Posit Education team posted the source for the Primers at GitHub under a Creative Commons license, so for Spring 2024, I maintained a Shiny server with the tutorials I needed for my classes.

The magic of webR

Starting in 2023, webR—a version of R compiled to run with Javascript in a web browser—underwent rapid development, and a new Quarto extension ({quarto-webr}) has since been developed to make it almost trivially easy to include Shiny-free interactive R chunks directly in the browser, like this:

That’s so magical!

So for my Summer 2024 classes, I decided to take the plunge and convert the Shiny-based {learnr} tutorials that I’ve been using for so long into a webR-based website.

How it works

The tutorials aren’t nearly as fully featured as {learnr}, but they get the job done.

{learnr} hints and solutions

To simulate {learnr}’s hint and solution functionality, I use Quarto’s Tabset Panels:

::: {.panel-tabset}
## {{< fa code >}}&ensp;Interactive editor

```{webr-r}
# Calculate 1 + 2
```

## {{< fa lightbulb >}}&ensp;Hint

**Hint:** Think about addition

## {{< fa circle-check >}}&ensp;Solution

```r
1 + 2
```

:::

Hint: Think about addition

1 + 2

{learnr} progressive reveal

One great feature of {learnr} is its progressive reveal, which unhides sections of a tutorial as you work through it. To simulate this with Quarto, I turned to Javascript. My progressive-reveal.js script looks for all third-level headings on a page (similar to {learnr}) and makes the appear progressively using some buttons at the bottom of the page. It’s clunky, but it works.

Quizzes

{learnr} also supports interactive questions, or inline quiz questions. To simulate this, I use {checkdown}. It’s not as great as {learnr}, but again, it gets the job done.1

Footnotes

  1. I also played with {webexercises}, which is a little more polished, but doesn’t let you give feedback messages for in/correct answers. I’m tempted to fork {checkdown} or submit a bunch of PRs to make it nicer. Someday.↩︎