question_checkbox: Checkbox question

Description Usage Arguments See Also Examples

View source: R/question_checkbox.R

Description

Creates a checkbox group tutorial quiz question. The student may select one or more checkboxes before submitting their answer.

Usage

1
2
3
4
5
6
7
8
9
question_checkbox(
  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.

See Also

question_radio, question_text

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
question_checkbox(
  "Select all the toppings that belong on a Margherita Pizza:",
  answer("tomato", correct = TRUE),
  answer("mozzarella", correct = TRUE),
  answer("basil", correct = TRUE),
  answer("extra virgin olive oil", correct = TRUE),
  answer("pepperoni", message = "Great topping! ... just not on a Margherita Pizza"),
  answer("onions"),
  answer("bacon"),
  answer("spinach"),
  random_answer_order = TRUE,
  allow_retry = TRUE,
  try_again = "Be sure to select all four toppings!"
)

learnr documentation built on March 26, 2020, 7:45 p.m.