r-exams

Obtain same question set when using exams2webquiz and exams2openolat


exams2webquiz has a seed argument, but exams2openolat does not. Besides manually specifying a seed in every question and fixing the question selection aspects, are there any straightforward solutions? Can I generate some kind of generic question set that can be saved and then turned into the relevant formats?


Solution

  • TL;DR

    Currently, there is no proper and straightforward solution for this, unfortunately. See below for a hacky workaround, helping to implement the seed strategy from your question.

    Details:

    In general, it is not always possible to use the result from one exams2xyz interface in another exams2xyz interface because one might need different processing of the exercises (e.g., regarding markup of the text, the type of graphics, the way certain supplements are embedded, etc.). So it is usually recommended to start out from the source exercises again.

    Sometimes it is sufficient to set the same random see before calling different exams2xyz interfaces. However, for exams2openolat it is not because random IDs are generated for several XML elements in between the exercises.

    One workaround that we have used for other interfaces is to specify a file matrix which exactly indicates which exercise file should be used in which replication. And then we can supply a random seed matrix of the same dimension. It would be more or less straightforward to add this functionality to exams2openolat. But in exams2webquiz it would take a bit more work because this is structured a bit differently.

    Workaround:

    If you don't want to put fixed seeds into your Rmd (or Rnw) exercises, you can do so on the fly via expar(). To do so for a given exercise, say myexercise.Rmd, include the following in the first code chunk (or add a code chunk if none exists yet):

    seed <- NULL
    if(!is.null(seed)) set.seed(seed)
    

    Thus, if you run exams2xyz("myexercise.Rmd") then nothing happens and no random seed is set. But if you use exams2xyz(expar("myexercise.Rmd", seed = 123)) then you internally create a copy of myexercise.Rmd in a temporary directory where the line above is replaced by

    seed <- 123
    

    So with this idea you can run expar(..., seed = ...) on all the exercises you want to put into your tests, thus creating static copies of these exercises. And then you can use these static copies in both exams2webquiz() and exams2openolat().