get_tutorial_state {learnr}R Documentation

Observe the user's progress in the tutorial

Description

As a student progresses through a learnr tutorial, their progress is stored in a Shiny reactive values list for their session (see shiny::reactiveValues()). Without arguments, get_tutorial_state() returns the full reactiveValues object that can be converted to a conventional list with shiny::reactiveValuesToList(). If the label argument is provided, the state of an individual question or exercise with that label is returned.

Calling get_tutorial_state() introduces a reactive dependency on the state of returned questions or exercises unless called within isolate(). Note that get_tutorial_state() will only work for the tutorial author and must be used in a reactive context, i.e. within shiny::observe(), shiny::observeEvent(), or shiny::reactive(). Any logic observing the user's tutorial state must be written inside a context="server" chunk in the tutorial's R Markdown source.

Usage

get_tutorial_state(label = NULL, session = getDefaultReactiveDomain())

Arguments

label

A length-1 character label of the exercise or question.

session

The session object passed to function given to shinyServer. Default is shiny::getDefaultReactiveDomain().

Value

A reactiveValues object or a single reactive value (if label is provided). The names of the full reactiveValues object correspond to the label of the question or exercise. Each item contains the following entries:

See Also

get_tutorial_info()


[Package learnr version 0.11.5 Index]