LearnR-style question

question(
  text,
  ...,
  type = c("auto", "single", "multiple", "learnr_radio", "learnr_checkbox",
    "learnr_text"),
  correct = "Correct!",
  incorrect = "Incorrect",
  try_again = incorrect,
  message = NULL,
  post_message = NULL,
  loading = c("**Loading:** ", text, "<br/><br/><br/>"),
  submit_button = "Submit Answer",
  try_again_button = "Try Again",
  allow_retry = FALSE,
  random_answer_order = FALSE,
  options = list()
)

Arguments

text

The question text

...

Answers (see webexercises::answer)

type

The input type (only single for now)

correct

(not used yet)

incorrect

(not used yet)

try_again

(not used yet)

message

(not used yet)

post_message

(not used yet)

loading

(not used yet)

submit_button

(not used yet)

try_again_button

(not used yet)

allow_retry

(not used yet)

random_answer_order

Whether to randomise the order of the answers

options

(not used yet)

Value

html for the webexercises question

Examples

question("Is R fun?",
         answer("Yes", TRUE),
         answer("No"),
         random_answer_order = TRUE)
#> [1] "<div class='webex-question'><span class='webex-question-text'>Is R fun?</span><select class='webex-select'><option value='blank'></option><option value='x'>No</option><option value='answer'>Yes</option></select></div>"