powered by
Add interactive ranking tasks to your learnr tutorials. The student can drag-and-drop the answer options into the desired order.
learnr
question_rank( text, ..., correct = "Correct!", incorrect = "Incorrect", loading = c("**Loading:** ", text, ""), 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().
learnr::question()
For question, text to print for a correct answer (defaults to "Correct!"). For answer, a boolean indicating whether this answer is correct.
question
answer
Text to print for an incorrect answer (defaults to "Incorrect") when allow_retry is FALSE.
allow_retry
FALSE
Loading text to display as a placeholder while the question is loaded
Label for the submit button. Defaults to "Submit Answer"
"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().
type = sortable_rank
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.
# NOT RUN { ## Example of rank problem inside a learnr tutorial if (interactive()) { learnr::run_tutorial("question_rank", package = "sortable") } # }
Run the code above in your browser using DataLab