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",
loading = c("**Loading:** ", text, "<br/><br/><br/>"),
submit_button = "Submit Answer",
try_again_button = "Try Again",
allow_retry = FALSE,
random_answer_order = TRUE,
options = sortable_options()
)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. If not provided, generic "Loading..." or placeholder elements will be displayed.
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
A custom learnr question, with type = sortable_rank.
See learnr::question().
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.
## Example of rank problem inside a learnr tutorial
if (interactive()) {
learnr::run_tutorial("question_rank", package = "sortable")
}