I am using R/exams to generate Moodle exams (Thanks Achim and team). I would like to make an introductory page to set the scenario for the exam. Is there a way to do it? (Now, I am generating a schoice
with answerlist
blank.)
Thanks!
João Marôco
Usually, I wouldn't do this "inside" the exam but "outside". In Moodle you can include a "Description" in the "General Settings" when editing the quiz. This is where I would put all the general information so that students read this before starting with the actual questions.
If you want to include R-generated content (R output, graphics, data, ...) in this description I would usually include this in "Question 1" rather than as a "Question 0" without any actual questions.
The "description"
question type could be used for the latter, though. However, it is currently not supported in exams2moodle()
(I'll put it on the wishlist). You could manually work around this in the following steps:
string
question with the desired content and set the associated expoints
to 0
.exams2moodle()
.Open the XML file in a text editor or simply within RStudio and replace <question type="shortanswer">
with <question type="description">
for the relevant questions.
In the XML file omit the <answer>
...</answer>
for the relevant questions.
Caveat: As you are aware it is technically possible to share the same data across subsequent exercises within the same exam. If .Rnw
exercises are used, all variables from the exercises are created in the global environment (.GlobalEnv
) and can be easily accessed anyway. If .Rmd
exercises are used, it is necessary to set the envir
argument to a dedicated shared environment (e.g., .GlobalEnv
or a new.env()
) in exams2moodle(..., envir = ...)
. However, if this is done then no random exercises must be drawn in Moodle because this would break up the connections between the exercises (i.e., the first replication in Question 1 is not necessarily followed by by the first replication in Question 2). Instead you have to put together tests with a fixed selection of exercises (i.e., always the first replication for all questions or the second replication for all questions, ...).