| moodle_m2s {exams.forge} | R Documentation |
Moodle Multiple-Choice
Description
The exams package does not support multiple-choice questions with multiple correct answers; it only allows for one answer to be chosen.
However, Moodle does support such questions. The function reads the XML file generated by exams.forge and makes changes
for all mchoice questions:
-
<single>...</single>to<single>true</single>, and modifies the attribute
fractionin the tags<answer fraction="...">...</answer>. Iffractionis less than 0, it is set to zero, and iffractionis greater than 0, it is set to 100.
If the file does not end with .xml, then .xml is appended. At the end, the modified XML code is stored in newfile.
Usage
moodle_m2s(file, newfile = NULL, verbose = 1)
mchoice_moodle(file, newfile = NULL, verbose = 1)
Arguments
file |
character: Moodle XML file with exercises to read from |
newfile |
character: Moodle XML file to write in (default: |
verbose |
integer: output generation (default: |
Value
Invisibly, the written file name.
Examples
if (interactive()) {
newfile <- tempfile(fileext=".xml")
moodle_m2s(system.file("xml", "klausur-test.xml", package="exams.moodle"), newfile=newfile)
file.edit(newfile)
}