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

- 15,710
- 1
- 39
- 49

- 644
- 1
- 7
- 19
1 Answers
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:
- Create a
string
question with the desired content and set the associatedexpoints
to0
. - Generate the Moodle XML output as usual with
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, ...).

- 15,710
- 1
- 39
- 49
-
Thanks @Achim Zeileis for your prompt answer. I need to generate random data for the moodle exam (and display it in the intro page). The questions pages would than be generated with rexams from the data generated in the intro page... That is why I wanted an intro without any questions in R exams... My Exam structure is like this: 0. intro page (with a data table with several variables generated from `rnorm()` 1. Descriptive statistics questions page (means from variables _x_, _y_ in data table present in the intro page). 2. Statistical test (paired t-test compare means from _x_ and _y_ – JPMD May 29 '20 at 10:35
-
1I understand. Personally, I would merge 0 and 1 into the same exercise, though. But more importantly, your approach of re-using the same random data set only works if you have a single random version. In contrast, if you generate `exams2moodle(..., n = 3)` versions (let's call them a / b / c) you cannot assure that students that got question 1a also get question 2a and not 2b or 2c. Maybe you can edit your question to clarify what exactly you do? Then I'll adapt my answer afterwards. – Achim Zeileis May 30 '20 at 01:16
-
Thanks Achim. What we need is an intro page with random data generated (intro.Rmd), than a Group 1 (cloze schoice + num) and a Group 2 (cloze schoice+num). If we do ```exams2moodle (c("intro.Rmd", "group1", "group2", file=exam, n=2)```... won't I get two different exams? intro1+Group1_1+Group2_1 and Intro2+Group1_2+Group2 ? I will then import the questions to moodle and do not randomize the question in the test. I will do two tests in Moodle choosing intro1+group1_1+group2_2 for the first test, and intro2+group1_2+group2_2 for the 2nd test. – JPMD May 30 '20 at 22:26
-
In the quiz module of Moodle you can create an "introduction" page with "OTHER > Description" in the question Type. I wonder if this "description type could be added to exams2moodle()... – JPMD May 30 '20 at 23:26
-
1OK, thanks. This is currently not possible like that but I've added it to the wishlist. I also expanded my answer to cover the different aspects. – Achim Zeileis May 31 '20 at 14:20
-
Hi @Achim Zeileis. Any new development of this? I guess that with the omnibus online testing due to the covid19 pandemic, it would be very useful to a lot of teachers... – JPMD Feb 03 '21 at 14:46
-
1No news, sorry. – Achim Zeileis Feb 03 '21 at 19:29
-
Hey. I have a situation similar to the one exposed here. Are there any news about its eventual solution? Thank you. – Álvaro Ángel Molina Jul 29 '21 at 20:48