Description Usage Arguments Details See Also Examples
A collection of convenience functions for formatting in exam generation that can be used for switching between suitable logical/text/numeric representations of multiple choice solutions.
1 2 3 4 | mchoice2string(x, single = FALSE)
string2mchoice(x, single = FALSE)
mchoice2text(x, markup = c("latex", "markdown"))
answerlist(..., sep = ". ", markup = c("latex", "markdown"))
|
x |
an object, see below for examples. |
single |
logical. Should the function check whether exactly a single answer is true? |
... |
character vectors to be included in answer lists. |
sep |
character for separation between vectors, see below for examples. |
markup |
character indicating which markup (LaTeX vs. Markdown) should be generated. |
Three convenience functions for facilitating work with multiple choice solutions of exams. All have almost trivial definitions, see also examples below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## multiple choice answer
mc <- c(TRUE, FALSE, TRUE, FALSE, FALSE)
## switching to string representation
mchoice2string(mc)
## reverse string encoding
string2mchoice("10100")
## switching to text
mchoice2text(mc)
## generating answerlist based on questions,
## solutions and explanations
qu <- c("Zurich is the capital of Switzerland.",
"Italian is an official language in Switzerland.",
"Switzerland is part of the European Union.")
sol <- c(FALSE, TRUE, FALSE)
ex <- c("The capital of Switzerland is Bern.",
"The four official languages are: German, French, Italian, Romansh.",
"Switzerland is part of the Schengen Area but not the European Union.")
answerlist(qu)
answerlist(ifelse(sol, "True", "False"), ex)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.