This article is originally published at https://www.rstudio.com/blog/
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
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:
Narrative, figures, illustrations, and equations.
Code exercises (R code chunks that users can edit and execute directly).
Videos (supported services include YouTube and Vimeo).
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.
Test out the latest interactive demo of
sortable's ranking quiz question.
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.
learnr::run_tutorial("quiz_question", "learnr") for more information.
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.
?learnr::available_tutorials for more information.
Using the latest
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
.Rbuildignore for an example.
Deploying dependencies not found
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.
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
Quiz questions are implemented using shiny modules (instead of htmlwidgets). (#194)
Added a new function,
safe, which evaluates code in a new, safe R environment. (#174)
Minor new features and improvements
Added the last evaluated exercise submission value,
last_value, as an exercise checker function argument. (#228)
Question width will expand to the container width. (#222)
Available tutorial names will be displayed when no
nameparameter or an incorrect
nameis provided to
optionsparameter was added to
questionto allow custom questions to pass along custom information. See
sortable::sortable_questionfor an example. (#243)
Missing package dependencies will ask to be installed at tutorial run time. (
When questions are tried again, the existing answer will remain, not forcing the user to restart from scratch. (#270)
A version number has been added to
question_submissionevents. This will help when using custom storage methods. (#291)
Tutorial storage on the browser is now executed directly on
localforage). This change prevents browser tabs from blocking each other when trying to access
Fixed a spurious console warning when running exercises using Pandoc 2.0. (#154)
Removed a warning created by pandoc when evaluating exercises where pandoc was wanting a title or pagetitle. #303
Please visit source website for post related comments.