Longer MCQs with Radio Buttons

longmcq(opts)

Arguments

opts

Vector of alternatives. The correct answer is the element(s) of this vector named 'answer'.

Value

A character string containing HTML code to create a set of radio buttons.

Details

Writes html code that creates a radio button widget, with a single correct answer. This is more suitable for longer answers. Call this function inline in an RMarkdown document. See the Web Exercises RMarkdown template for further examples.

Examples

# What is a p-value?
opts <- c(
  "the probability that the null hypothesis is true",
  answer = paste("the probability of the observed, or more extreme, data",
                 "under the assumption that the null-hypothesis is true"),
  "the probability of making an error in your conclusion"
)

longmcq(opts)
#> [1] "<div class='webex-radiogroup' id='radio_ILILLQMOPW'><label><input type=\"radio\" autocomplete=\"off\" name=\"radio_ILILLQMOPW\" value=\"\"></input> <span>the probability that the null hypothesis is true</span></label><label><input type=\"radio\" autocomplete=\"off\" name=\"radio_ILILLQMOPW\" value=\"answer\"></input> <span>the probability of the observed, or more extreme, data under the assumption that the null-hypothesis is true</span></label><label><input type=\"radio\" autocomplete=\"off\" name=\"radio_ILILLQMOPW\" value=\"\"></input> <span>the probability of making an error in your conclusion</span></label></div>\n"