Automatic generation of exams in QTI 1.2 with some tweaks (still under development) for the learning management system ILIAS.
exams2ilias(file, n = 1L, nsamp = NULL, dir = ".",
name = NULL, quiet = TRUE, edir = NULL, tdir = NULL, sdir = NULL,
verbose = FALSE, resolution = 100, width = 4, height = 4, svg = FALSE,
encoding = "UTF-8", num = list(fix_num = FALSE, minvalue = NA),
mchoice = list(maxchars = c(3, NA, 3), minvalue = NA),
schoice = mchoice, string = NULL, cloze = NULL,
template = "ilias",
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),
converter = "pandoc-mathjax", xmlcollapse = TRUE,
metasolution = FALSE, ...)
exams2ilias
returns a list of exams as generated by xexams
.
If zip
is TRUE
(default), an ILIAS Questionpool object is generated.
character. A specification of a (list of) exercise files.
integer. The number of copies to be compiled from file
.
integer. The number(s) of exercise files sampled from each
list element of file
. Sampling without replacement is used
if possible. (Only if some element of nsamp
is larger than
the length of the corresponding element in file
, sampling
with replacement is used.)
character. The default is the current working directory.
character. A name prefix for resulting exercises and ZIP file.
logical. Should output be suppressed when calling
xweave
?
character specifying the path of the directory (along with its
sub-directories) in which the files in file
are stored
(see also xexams
).
character specifying a temporary directory, by default
this is chosen via tempfile
. Note that this
is cleaned up (i.e., existing files are deleted) and only certain
temporary files are preserved.
character specifying a directory for storing supplements, by
default this is chosen via tempfile
.
logical. Should information on progress of exam generation be reported?
numeric. Options for rendering PNG (or SVG)
graphics passed to xweave
.
logical. Should graphics be rendered in SVG or PNG (default)?
character, ignored. The encoding is always assumed to be UTF-8.
function or named list applied to numerical (i.e., type num
)
questions. If num
is a function, num
will be used
for generating the item body of the question, see function make_itembody_qti12()
(or make_itembody_qti21()
).
If num
is a named list, these arguments will be passed to function
make_itembody_qti12()
(or make_itembody_qti21()
using exams2qti21()
).
function or named list applied to multiple choice,
single choice, string, and cloze questions (i.e., type mchoice
, schoice
,
string
, and cloze
), respectively. See argument num
for more details.
character. The IMS QTI 1.2 or 2.1 template that should be used. Currently,
the package provides "qti12.xml"
and "qti21.xml"
.
integer. Set the duration of the exam in minutes.
character. A title that should be used for the sections. May be a vector of length 1 to use the same title for each section, or a vector containing different section titles.
character. A title that should be used for the assessment items. May be a vector of length 1 to use the same title for each item, or a vector containing different item titles. Note that the maximum of different item titles is the number of sections/questions that are used for the exam.
character. Description (of length 1) for the overall assessment (i.e., exam).
character. Vector of descriptions for each section, omitted if empty
(or NULL
or FALSE
).
integer. The maximum attempts for one question. This may also be a vector
so that the maximum number of attempts varies across questions. A value of Inf
or
0
signals that the attempts per question are not limited.
numeric. The cutvalue at which the exam is passed.
logical. Should the question/item solutionswitch be enabled?
In OLAT this means that the correct solution is shown after an incorrect solution
was entered by an examinee (i.e., this is typically only useful if maxattempts = 1
).
logical. Should the resulting XML file (plus supplements) be zipped?
integer. How many points should be assigned to each exercise? Note that this
argument overules any exercise points that are provided within an "\expoints{}"
tag
in the .Rnw
file. The vector of points supplied is expanded to the number of exercises in
the exam.
named list, specifies the settings for the evaluation policy, see function
exams_eval
.
character. Argument passed on to make_exercise_transform_html
.
The default for converter
is set to "ttm"
unless there are Rmd
exercises in file
where "pandoc"
is used.
logical or character. Should line breaks be collapsed in the XML
code. If TRUE
everything is collapsed with spaces (" "
) but other collapse
characters could be supplied.
logical. Should the solution be added to the XML output as qtimetadata tag? This currently only works for ILIAS essay questions.
further arguments passed on to make_exercise_transform_html
.
exams2ilias
is a convenience interface to exams2qti12
for generating QTI 1.2 with some tweaks for ILIAS (https://www.ilias.de/).
The support for ILIAS so far is somewhat rudimentary. Not all question
types are currently supported. What has been tested most extensively, are
string questions with open answers and solutions; these are rendered into
ILIAS essay questions within a question pool. Also mchoice and schoice
questions render in ILIAS, but have received less amount of testing.
Numeric and cloze questions do not work yet.
exams2qti12
,
## load package and enforce par(ask = FALSE)
library("exams")
options(device.ask.default = FALSE)
## define an exams (= list of exercises)
myexam <- list(
## multiple-choice with graphics
c("boxplots.Rmd", "scatterplot.Rmd"),
## multiple-choice with output or tables
c("ttest.Rmd", "anova.Rmd", "relfreq.Rmd"),
## single-choice
c("deriv2.Rmd", "swisscapital.Rmd"),
## string (closed)
"function.Rmd",
## string (open-ended)
"essayreg.Rmd"
)
## output directory
dir.create(mydir <- tempfile())
## generate .zip with ILIAS Questionpool in temporary directory
## using a few customization options
exams2ilias(myexam, n = 3, dir = mydir,
maxattempts = 3,
num = list(digits = 1),
mchoice = list(shuffle = TRUE, enumerate = FALSE),
solutionswitch = FALSE
)
dir(mydir)
Run the code above in your browser using DataLab