mcq: Create a multiple-choice question

Description Usage Arguments Details Examples

View source: R/webex_fns.R

Description

Create a multiple-choice question

Usage

1
mcq(opts)

Arguments

opts

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

Details

Writes html code that creates an option box widget, with a single correct answer. Call this function inline in an RMarkdown document. See the Web Exercises RMarkdown template for further examples.

Examples

1
2
3
4
5
# How many planets orbit closer to the sun than the Earth?
mcq(c(1, answer = 2, 3))

# Which actor played Luke Skywalker in the movie Star Wars?
mcq(c("Alec Guinness", answer = "Mark Hamill", "Harrison Ford"))

Example output

[1] "<select class='solveme' data-answer='[\"2\"]'> <option></option> <option>1</option> <option>2</option> <option>3</option></select>"
[1] "<select class='solveme' data-answer='[\"Mark Hamill\"]'> <option></option> <option>Alec Guinness</option> <option>Mark Hamill</option> <option>Harrison Ford</option></select>"

webex documentation built on June 10, 2021, 9:09 a.m.

Related to mcq in webex...