Skip to content


Repository files navigation


Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept. Blog post

Can you match the tidyverse function to the package name? A multiple choice quiz hacked together with {learnr}.

Answering a question and geting a new one


Can you always remember which tidyverse function comes from which tidyverse package? Inspired by frustrations of Ryan Timpe, Daniel McNichol, and others I'm sure.

The {learnr} package lets you build quizzes, obstensibly for learning about R. I wondered if you could use it to serve a randomised question about what function belongs to which tidyverse package. It's a bit hacky: you have to click the 'get question' button to begin and then 'start over' each time you want a new question.

You can read the accompanying blog post for more info on how it was built.

How to run

Install the package and run the app with the following commands:

  1. install.packages(c("remotes", "pacman", "tidyverse", "learnr")) to install {learnr} from CRAN (beware: this will install a lot of packages)
  2. remotes::install_github("matt-dray/tidyquiz") to install this package from GitHub
  3. learnr::run_tutorial("tidy", package = "tidyquiz") to open in your browser

The app is no longer hosted online.


Do I have to install loads of packages for this to work?

Yes, if installing locally. This thing works on the fly. It fetches the tidyverse packages and creates questions and answers whenever you run generate_quiz(). This means you should be prepared for all the tidyverse packages to be downloaded to your machine. On the plus side, functions presented to you in the quiz will always be current.

The list of packages can be found in tidyverse::tidyverse_packages(). At time of writing (2019-03-17) the packages are:

"broom"     "cli"         "crayon"   "dplyr"     "dbplyr"      "forcats"
"ggplot2"   "haven"       "hms"      "httr"      "jsonlite"    "lubridate"
"magrittr"  "modelr"      "purrr"    "readr"     "readxl"      "reprex"
"rlang"     "rstudioapi"  "rvest"    "stringr"   "tibble"      "tidyr"      
"xml2"      "tidyverse"  

What about functions that mask other functions?

There's only ever one correct answer from the four presented. If you are presented with a function that exists in multiple packages, the answer set will include one package it definitely exists in and three it definitely doesn't exist in.


📦❓ R Shiny app: a {tidyverse} quiz via {learnr} hacking