learnr Tutorials

Run a learnr Tutorial

run_tutorial()

Run a tutorial

available_tutorials()

List available tutorials

safe()

Execute R code in a safe R environment

Write or Configure a learnr Tutorial

tutorial()

Tutorial document format

tutorial_options()

Set tutorial options

tutorial_package_dependencies()

List tutorial dependencies

Interactive Questions

quiz() question()

Tutorial quiz questions

question_checkbox()

Checkbox question

question_radio()

Radio question

question_numeric()

Number question

question_text()

Text box question

answer() answer_fn()

Question answer options

correct() incorrect() mark_as()

Mark submission as correct or incorrect

Random Praise and Encouragement

random_praise() random_encouragement()

Random praise and encouragement

random_phrases_add()

Add phrases to the bank of random phrases

Developer Tools

These functions were designed for use by developers who want to extend learnr with custom formats or interactive question types, or for those who wish to deploy learnr tutorials in custom environments.

Questions

Functions intended for use by developers creating custom questions for learnr.

disable_all_tags()

Disable all html tags

finalize_question()

Finalize a question

question_ui_initialize() question_ui_try_again() question_ui_completed() question_is_valid() question_is_correct()

Custom question methods

knit_print(<tutorial_question>) knit_print(<tutorial_quiz>)

Knitr quiz print methods

format(<tutorial_question_answer>) format(<tutorial_question>) format(<tutorial_quiz>) print(<tutorial_question>) print(<tutorial_question_answer>) print(<tutorial_quiz>)

Formatting and printing quizzes, questions, and answers

State and Events

get_tutorial_info()

Get information about the current tutorial

get_tutorial_state()

Observe the user's progress in the tutorial

filesystem_storage()

Filesystem-based storage for tutor state data

event_register_handler()

Register an event handler callback

one_time()

Wrap an expression that will be executed one time in an event handler

General Tools

duplicate_env()

Create a duplicate of an environment

initialize_tutorial()

Initialize tutorial R Markdown extensions

external_evaluator()

External execution evaluator

tutorial_html_dependency()

Tutorial HTML dependency