A simple multiple choice system in a R chunk, compatible with git and R Markdown or Quarto documents. obfuscate() and get_word() are used to hide correct answers in the testthat tests.

select_answer(x, name = NULL)

obfuscate(x)

get_word(x)

Arguments

x

A String with the different answers, starting with []. The user has to "check" the correct items by adding 'x' or 'X' inside the brackets

name

The name of the select_answer. If not provided, the label of the chunk where the select_answer() function is placed.

Value

A Markdown paragraph containing only the selected items (and the selected items are also written in a result file)