Create a true-or-false question

torf(answer)

Arguments

answer

Logical value TRUE or FALSE, corresponding to the correct answer.

Details

Writes html code that creates an option box widget with TRUE or FALSE as alternatives. Call this function inline in an RMarkdown document. See the Web Exercises RMarkdown template for further examples.

Examples

# True or False? 2 + 2 = 4 torf(TRUE)
#> [1] "<select class='webex-select'><option value='blank'></option><option value='answer'>TRUE</option><option value=''>FALSE</option></select>"
# True or False? The month of April has 31 days. torf(FALSE)
#> [1] "<select class='webex-select'><option value='blank'></option><option value=''>TRUE</option><option value='answer'>FALSE</option></select>"