Forum: support
Monitor Forum | | RE: Randomize the order of questions in ops [ Reply ] By: Achim Zeileis on 2026-02-23 10:30 | [forum:50151] |
|
Manuele, good question. It isn't possible to specify this directly in exams2nops(). But you can do the sampling yourself and provide exams2nops() with the desired order in a matrix. ## exercise pools myexam <- list( c("capitals.Rmd", "swisscapital.Rmd", "switzerland.Rmd"), c("deriv2.Rmd", "hessian.Rmd", "fruit2.Rmd", "cholesky.Rmd") ) ## draw 5 times 1 exercise from first pool and 3 exercises from second mymat <- replicate(5, c(sample(myexam[[1]], 1), sample(myexam[[2]], 3))) ## randomize order in each exam mymat <- t(apply(mymat, 2, sample)) ## call exams2nops ex1 <- exams2nops(mymat) This also allows to partially fix the order exercises while permuting certain blocks etc. |
|
| Randomize the order of questions in ops [ Reply ] By: Manuele Leonelli on 2026-02-23 10:02 | [forum:50150] |
|
Dears, I am creating a set of 60 exams of 30 questions, each question sampled at random from a corresponding question bank. I would like however to also randomize the order in which the questions banks are considered, so that in not all exams the first question comes from the first question bank. Is that achievable? Currently a skeleton code (just two questions for now) is: library(exams) set.seed(403) bank_Q1 <- list.files("Questions/Q1", pattern="\\.Rmd$", full.names=TRUE) bank_Q2 <- list.files("Questions/Q2", pattern="\\.Rmd$", full.names=TRUE) myexam <- list( bank_Q1, bank_Q2 ) ex1 <- exams2nops(myexam, n = 5, dir = "output", name = "demo", duplex = F, points = rep(1,length(myexam)), showpoints = FALSE, nchoice = 4) Thanks! Manuele |
|

