It is often useful to create many quiz questions based on a common premise, such as a case description or other scenario. Understanding the case scenario consumes a fair amount of the student’s attention and working memory, and it is good use of the student’s time to practice or test many learning objectives based on that single investment of time.
You can see a working example by using the
demo_multistage
template at
RStudio > New > R markdown > From template > demo_multistage {examiner}
.
Remembering R data across quiz question files
Now, if your scenario uses data structures that you have computed or modified yourself, you need some way to remember that data between sub-question files of a multi-stage exercise.
With examiner
, each question file gets knitted in a
separate R session, with no memory of what has been computed before.
However, they are knitted in the order they appear in the quiz
file’s questions
list.
Thus, one very simple way to “remember” data from one question to the
next is to save()
the necessary variables in an
.Rdata
file. That format can represent nearly any R object
faithfully.
Personally, I often compute the premises for all sub-questions in the question file for the first “stage”. That way, I only need to rerun the first-stage Rmd file to get a clean start for re-knitting subsequent stages.