exams2qti12(file, n = 1L, nsamp = NULL, dir = ".",
name = NULL, quiet = TRUE, edir = NULL,
tdir = NULL, sdir = NULL, resolution = 100,
width = 4, height = 4, 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, ...) make_itembody_qti12(rtiming = FALSE, shuffle = FALSE,
rshuffle = shuffle, minnumber = NULL, maxnumber = NULL,
defaultval = NULL, minvalue = NULL, maxvalue = NULL,
cutvalue = NULL, enumerate = TRUE, digits = 2,
tolerance = is.null(digits), maxchars = 12)
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
.tempdir
.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"
.Inf
.maxattempts = 1
).num
exercises?digits = NULL
, type num
questions will use a
tolerance interval for checking if the supplied answer/number is correct.make_exercise_transform_html
.exams2qti12
will produce a .zip
file that may be uploaded (e.g. in OLAT) including
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 hard-coded 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 contain of 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 the default correct solution for numeric answers is a character string that is generated
by the rounded value of the exact solution provided in the metainfo
of the question (and
may be controlled by argument in digits
in make_itembody_qti12
). I.e. in a test, the
answer must be provided exactly to the decimal places specified in digits
and has no upper
or lower tolerance level (e.g., if the exact solution is 16.4562 and digits = 2
, then the
correct answer in the test will be "16.46"
, i.e., a character string of 5 characters). This
may be easily changed by setting num = list(digits = NULL)
to suppress rounding, while the
numeric question should then provide a tolerance level, which should be set within the
.Rnw
, but may also be hard-set in make_itembody_qti12
.
exams2qti12
returns a list of exams as generated by xexams
.
make_itembody_qti12
returns a function that generates the XML code
for the itembody tag in IMS QTI 1.2 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)