Add interactive ranking tasks to your learnr tutorials. The student can drag-and-drop the answer options into the desired order.

question_rank(
text,
...,
correct = "Correct!",
incorrect = "Incorrect",
try_again_button = "Try Again",
allow_retry = FALSE,
options = sortable_options()
)

Arguments

text Question or option text parameters passed onto learnr::question(). For question, text to print for a correct answer (defaults to "Correct!"). For answer, a boolean indicating whether this answer is correct. Text to print for an incorrect answer (defaults to "Incorrect") when allow_retry is FALSE. Loading text to display as a placeholder while the question is loaded Label for the submit button. Defaults to "Submit Answer" Label for the try again button. Defaults to "Submit Answer" Allow retry for incorrect answers. Defaults to FALSE. Display answers in a random order. Options to be supplied to sortable_js object. See sortable_options for more details

Value

A custom learnr question, with type sortable_rank. See learnr::question_methods()

Details

Each set of answer options must contain the same set of answer options. When the question is completed, the first correct answer will be displayed.

Note that, by default, the answer order is randomized.

Examples

## Example of rank problem inside a learnr tutorial
if (interactive()) {
learnr::run_tutorial("question_rank", package = "sortable")
}