Sinval
Sinval

Reputation: 1417

How to deal with R/exams nops_pdf string questions?

I created several nops_pdf exams which produced several .rds with the exam information. I usually do it, and then use this code (provided by Achim) to merge all .rds:

## readRDS all *.rds files in the current working directory
x <- lapply(Sys.glob("exam/*.rds"), readRDS)

## combine all resulting lists
y <- do.call("c", x)

## saveRDS into a single .rds file
saveRDS(y, "exam/all.rds")

However, I created my nops exams with two string questions each. Everything seems to work correctly when I merge the different .rds in one single file. After running the nops_eval() function and checking the results I noticed that the string questions were not being accurately evaluated. I had to correct each one individually, each with its corresponding rds file and scans. Any idea why it does not work as usual?

Upvotes: 1

Views: 86

Answers (1)

Achim Zeileis
Achim Zeileis

Reputation: 17183

At the moment nops_eval() expects that the same exercise across replications has the same type and is associated with the same number of points. So, for example, all first exercises must be schoice and worth 2 points, all the second exercises mchoice and worth 3 points, and all third exercises string and worth 5 points.

When you use a single exams2nops() call, the code tries to check for this (at least to a certain degree). If you manually combine output from several exams2nops() calls you might circumvent this though and end up with the string exercises in different (random) positions. This will then lead to incorrect evaluations.

Let's assume that you have three schoice questions, five mchoice questions, and two string questions. And you want the schoice questions and mchoice questions in random order, then you could do it like this:

exm <- list(
  c("sc1.Rmd", "sc2.Rmd", "sc3.Rmd"),
  c("mc1.Rmd", "mc2.Rmd", "mc3.Rmd", "mc4.Rmd", "mc5.Rmd"),
  "str1.Rmd",
  "str2.Rmd"
)
exams2nops(exm, nsamp = c(3, 5, 1, 1), ...)

As a concrete example you can use:

exm <- list(
  c("deriv2.Rmd", "tstat2.Rmd", "swisscapital.Rmd"),
  c("switzerland.Rmd", "capitals.Rmd", "boxplots.Rmd", "ttest.Rmd", "anova.Rmd"),
  "function.Rmd",
  "countrycodes.Rmd"
)

Then the schoice questions will appear in random order but always as exercises 1-3, the mchoice questions will be in random order in exercises 4-8, the function exercise will always be question 9, and the country codes exercise always question 10.

Upvotes: 1

Related Questions