exams2qti12(file, n = 1L, nsamp = NULL, dir = ".",
name = NULL, quiet = TRUE, edir = NULL,
tdir = NULL, sdir = NULL, verbose = FALSE,
resolution = 100, width = 4, height = 4, encoding = "",
num = NULL, mchoice = NULL,
schoice = mchoice, string = NULL, cloze = NULL,
template = "qti12", duration = NULL,
stitle = "Exercise", ititle = "Question",
adescription = "Please solve the following exercises.",
sdescription = "Please answer the following question.",
maxattempts = 1, cutvalue = 0, solutionswitch = TRUE,
zip = TRUE, points = NULL,
eval = list(partial = TRUE, negative = FALSE),
...) exams2qti21(file, n = 1L, nsamp = NULL, dir = ".",
name = NULL, quiet = TRUE, edir = NULL,
tdir = NULL, sdir = NULL, verbose = FALSE,
resolution = 100, width = 4, height = 4, encoding = "",
num = NULL, mchoice = NULL,
schoice = mchoice, string = NULL, cloze = NULL,
template = "qti21", duration = NULL,
stitle = "Exercise", ititle = "Question",
adescription = "Please solve the following exercises.",
sdescription = "Please answer the following question.",
maxattempts = 1, cutvalue = 0, solutionswitch = TRUE,
zip = TRUE, points = NULL,
eval = list(partial = TRUE, negative = FALSE),
base64 = TRUE, mode = "hex", ...)
make_itembody_qti12(rtiming = FALSE, shuffle = FALSE,
rshuffle = shuffle, minnumber = NULL, maxnumber = NULL,
defaultval = NULL, minvalue = NULL, maxvalue = NULL,
cutvalue = NULL, enumerate = TRUE, digits = NULL,
tolerance = is.null(digits), maxchars = 12,
eval = list(partial = TRUE, negative = FALSE),
fix_num = TRUE)
make_itembody_qti21(shuffle = FALSE, defaultval = NULL,
minvalue = NULL, maxvalue = NULL, enumerate = TRUE,
digits = NULL, tolerance = is.null(digits), maxchars = 12,
eval = list(partial = TRUE, negative = FALSE),
solutionswitch = TRUE)
file
.file
. Sampling without replacement is used
if possible. (Only if some element of nsamp
is larger than
the length of the corresponding element in Sweave
?file
are stored (see also below).tempdir
. Note that this
is cleaned up and potentially temporary files are deleted.tempdir
.Sweave
.Sweave
.num
)
questions. If num
is a function, num
will be used
for generating the item body of the question, see function make_itembody_qti12()
mchoice
, schoice
,
string
, and cloze
), respectively. See argument num
for mo"qti12.xml"
and "qti21.xml"
.Inf
.maxattempts = 1
)."expoints{}"
tag
in the .Rnw
file. The vector of points supplied is expanded texams_eval
.base64
may
also be a character vector of file endings that should be Base 64 encoded, e.g.
base64 = c("png", "rda")
will only encode PNG images and binary tth
.exams2qti21()
the arguments have similanum
exercises?num
answer/number is correct? The default is to use tolerance intervals if digits = NULL
.make_exercise_transform_html
.exams2qti12
and exams2qti21
are
provided. The former has already been thoroughly tested and the latter is still in beta testing
stage and might change in future releases.
exams2qti12
produces a .zip
file that may be uploaded (e.g. in OLAT). This includes
the final XML file of the exam/assessement as well as possible supplement folders that include
images, data sets etc. used for the exam. It proceeds by (1) calling Sweave
on each exercise, (2) reading the resulting LaTeX code, (3) transforming the LaTeX code to HTML,
and (4) embedding the HTML code in a XML file using the IMS QTI 1.2 standards for assessements and
question items. For steps (1) and (2) the standard drivers in xexams
are used. In step (3), a suitable
transformation function is set up on the fly using make_exercise_transform_html
, see also
the details section in exams2html
.
For step (4), the function will cycle through all questions and exams to generate the final XML file in IMS QTI 1.2 standard. Therefore, each question will be included in the XML as one section. The replicates of each question will be written as question items of the section.
The function uses the XML template for IMS QTI 1.2 assessements and items to generate
the exam (per default, this is the XML file qti12.xml
provided in the xml
folder of
this package). The assessement template must provide one section including one item.
exams2qti12
will then use the single item template to generate all items, as well as the
assessement and section specifications set within the template.
The default template will generate exams/assessements that sample one replicate of a question/item
for each section. The ususal procedure in exam/assessement generation would be to simply copy &
paste the XML template of the package and adapt it to the needs of the user. Note that all
specifiers that have a leading ##} in the XML template will be replaced by suitable code in
exams2qti12
and should always be provided in the template. I.e., the user may add
additional tags to the XML template or modify certain specifications, like the number of
replicates/items that should be sampled for each section etc.
Per default, the individual question/item bodies are generated by function
make_itembody_qti12
, i.e. make_itembody_qti12
checks the type of the question and
will produce suitable XML code. Note that for each question type, either the arguments of
make_itembody_qti12
may be set within num
, mchoice
, schoice
,
string
and cloze
in exams2qti12
, by providing a named list of specifications
that should be used, or for each questiontype, a function that produces the item body XML code may
be provided to num
, mchoice
, schoice
, string
and cloze
. E.g.,
mchoice = list(shuffle = TRUE)
will force only multiple choice questions to have a shuffled
answerlist.
Note that in OLAT/OpenOLAT num
exercises are not officially supported but in fact work
correctly. The only drawback is that in certain settings the correct solution is not shown at the
end of the assessment (although it is used for all internal computations). Therefore, two workarounds
are implemented. Either fix_num
can be set to TRUE
(default), then a fix is added
by double-checking the result, or digits
can be set to a fixed value (e.g., digits = 2
).
In the latter case, the num
exercise is represented by a string
. Then the answer must
be provided exactly to the decimal places specified (e.g., if the exact solution is 16.4562, then the
correct answer in the test will be "16.46"
, i.e., a character string of 5 characters).
Generating exams/assessment in IMS QTI 2.1 format using exams2qti21()
and make_itembody_qti21()
is performed in a similar way as described above. Note that the IMS QTI 2.1 generators are
still work in progress. The generated XML files have been validated using the IMS validator provided
at
IMS Global Learning Consortium, Inc. (2012b).
IMS Question & Test Interoperability (QTI) XSD Binding Version 2.1 Final.
BPS Bildungsportal Sachsen GmbH (2014).
ONYX Testsuite.
Zeileis A, Umlauf N, Leisch F (2014).
Flexible Generation of E-Learning Exams in R: Moodle Quizzes, OLAT Assessments, and Beyond.
Journal of Statistical Software, 58(1), 1--36.
exams2qti12
and exams2qti21
return a list of exams as generated by xexams
.
make_itembody_qti12
and make_itembody_qti21
return a function that generates the XML code
for the itembody tag in IMS QTI 1.2 and IMS QTI 2.1 format.
xexams
,
ttm
,
tth
,
tex2image
,
make_exercise_transform_html
,
## define an exams (= list of exercises) myexam <- list( "boxplots", c("tstat", "ttest", "confint"), c("regression", "anova"), c("scatterplot", "boxhist"), "relfreq" )
## output directory mydir <- tempdir()
## generate .zip with QTI 1.2 exam in temporary directory ## using a few customization options exams2qti12(myexam, n = 3, dir = mydir, maxattempts = 3, num = list(digits = 1), mchoice = list(shuffle = TRUE, enumerate = FALSE) ) dir(mydir)