Learn R Programming

learnr (version 0.10.1)

question_radio: Radio question

Description

Creates a radio button tutorial quiz question. The student can select only one radio button before submitting their answer.

Usage

question_radio(
  text,
  ...,
  correct = "Correct!",
  incorrect = "Incorrect",
  try_again = incorrect,
  allow_retry = FALSE,
  random_answer_order = FALSE
)

Arguments

text

Question or option text

...

answers and extra parameters passed onto question.

correct

For question, text to print for a correct answer (defaults to "Correct!"). For answer, a boolean indicating whether this answer is correct.

incorrect

Text to print for an incorrect answer (defaults to "Incorrect") when allow_retry is FALSE.

try_again

Text to print for an incorrect answer (defaults to "Incorrect") when allow_retry is TRUE.

allow_retry

Allow retry for incorrect answers. Defaults to FALSE.

random_answer_order

Display answers in a random order.

Details

Note: Multiple correct answers are allowed.

See Also

question_checkbox, question_text

Examples

Run this code
# NOT RUN {
question_radio(
  "Pick the letter B",
  answer("A"),
  answer("B", correct = TRUE),
  answer("C"),
  answer("D"),
  allow_retry = TRUE,
  random_answer_order = TRUE
)
# }

Run the code above in your browser using DataLab