View source: R/question_rank.R
question_rank | R Documentation |
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()
)
text |
Question or option text |
... |
parameters passed onto |
correct |
For |
incorrect |
Text to print for an incorrect answer (defaults to
"Incorrect") when |
loading |
Loading text to display as a placeholder while the question is loaded. If not provided, generic "Loading..." or placeholder elements will be displayed. |
submit_button |
Label for the submit button. Defaults to |
try_again_button |
Label for the try again button. Defaults to |
allow_retry |
Allow retry for incorrect answers. Defaults to |
random_answer_order |
Display answers in a random order. |
options |
Options to be supplied to sortable_js object. See sortable_options for more 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.
A custom learnr
question, with type = sortable_rank
.
See learnr::question()
.
## Example of rank problem inside a learnr tutorial
if (interactive()) {
learnr::run_tutorial("question_rank", package = "sortable")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.