## initialize meta-information (done automatically within xweave())
initialize_exercise()
## add num, string, schoice, and mchoice elements
add_cloze(123.456789)
add_cloze("ABC")
add_cloze("high", c("low", "neutral", "high"))
add_cloze(c(
"Zurich is the capital of Switzerland." = FALSE,
"Italian is an official language in Switzerland." = TRUE,
"Switzerland is part of the European Union." = FALSE
), type = "mchoice")
## add a numeric matrix
tab <- matrix(10^(1:4), ncol = 2, byrow = TRUE,
dimnames = list(c("Top", "Bottom"), c("Left", "Right")))
add_cloze(tab)
## format collected meta-information
format_metainfo("type")
format_metainfo("solution")
format_metainfo("tolerance")
writeLines(format_metainfo("answerlist"))
## re-initialize cloze meta-information for cleanup
initialize_exercise()
## equivalent specifications of single/multiple-choice elements
add_cloze("high", c("low", "neutral", "high"), type = "schoice")
add_cloze(c("low" = FALSE, "neutral" = FALSE, "high" = TRUE), type = "schoice")
## format collected meta-information
format_metainfo("type")
format_metainfo("solution")
writeLines(format_metainfo("answerlist"))
## re-initialize cloze meta-information for cleanup
initialize_exercise()
Run the code above in your browser using DataLab