learnr 0.10.0 has been released! In this version of learnr, quiz questions have been expanded to allow for more question types. Text box quiz questions have been implemented natively within learnr and ranking questions have been implemented using the sortable package.

The learnr R package makes it easy to turn any R Markdown document into an interactive tutorial. Tutorials consist of content along with interactive components for checking and reinforcing understanding. Tutorials can include any or all of the following:

  1. Narrative, figures, illustrations, and equations.

  2. Code exercises (R code chunks that users can edit and execute directly).

  3. Quiz questions.

  4. Videos (supported services include YouTube and Vimeo).

  5. Interactive Shiny components.

Tutorials automatically preserve work done within them, so if a user works on a few exercises or questions and returns to the tutorial later they can pick up right where they left off.

Example

Test out the latest interactive demo of sortable’s ranking quiz question.

learnr::run_tutorial("question_rank", "sortable")

Highlights

New quiz questions

I am excited to announce that quiz questions are now mini shiny applications. This opens the door to new and extendable question types, such as text box and ranking questions. The sortable R package (an htmlwidgets wrapper around the drag-and-drop Sortable.js) has already implemented ranking questions using the new learnr quiz question API. Thank you Kenton Russell for originally pursuing sortable and Andrie de Vries for connecting the two packages.

Please see learnr::run_tutorial("quiz_question", "learnr") for more information.

Available tutorials

A new function, available_tutorials(), has been added. When called, this function will find all available tutorials in every installed R package. If a package name is provided, only that package will be searched. This functionality has been integrated into run_tutorial if a user provides a wrong tutorial name or forgets the package name.

Please see ?learnr::available_tutorials for more information.

Better pre-rendering

Using the latest rmarkdown, learnr tutorials are now agressively pre-rendered. For package developers, please do not include the pre-rendered HTML files in your package as users will most likely need to recompile the tutorial. See learnr’s .Rbuildignore for an example.

Deploying dependencies not found

If your learnr tutorial contains broken code within exercises for users to fix, the CRAN version of packrat will not find all of your dependencies to install when the tutorial is deployed. To deploy tutorials containing exercise code with syntax errors, install the development version of packrat. This version of packrat is able to find dependencies per R chunk, allowing for broken R chunks within the tutorial file.

remotes::install_github("rstudio/packrat")

Breaking changes

learnr 0.10.0 includes some non-backward-compatible bug fixes involving a the browser’s local storage. It is possible that the browser’s local storage will have a “cache miss” and existing users will be treated like new users.

learnr change log

New features

Minor new features and improvements

Bug fixes