Creates a radio button tutorial quiz question. The student can select only one radio button before submitting their answer. Note: Multiple correct answers are allowed.
question_radio(
text,
...,
correct = "Correct!",
incorrect = "Incorrect",
try_again = incorrect,
allow_retry = FALSE,
random_answer_order = FALSE
)Question or option text
Answers created with answer() or extra parameters passed onto
question(). Function answers are ignored for radio questions because the
user is required to select a single answer.
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.
Text to print for an incorrect answer (defaults to
"Incorrect") when allow_retry is TRUE.
Allow retry for incorrect answers. Defaults to FALSE.
Display answers in a random order.
Returns a learnr question of type "learnr_radio".
Other Interactive Questions:
question_checkbox(),
question_numeric(),
question_text(),
quiz()
question_radio(
"Pick the letter B",
answer("A"),
answer("B", correct = TRUE),
answer("C"),
answer("D"),
allow_retry = TRUE,
random_answer_order = TRUE
)
#> Question: "Pick the letter B"
#> type: "learnr_radio"
#> allow_retry: TRUE
#> random_answer_order: TRUE
#> answers:
#> X: "A"
#> ✔: "B"
#> X: "C"
#> X: "D"
#> messages:
#> correct: "Correct!"
#> incorrect: "Incorrect"
#> try_again: "Incorrect"