I am using num_to_choice to generate 5 options for a numeric exercise using the r exams package.
I want my sc$questions to include the correct solution (res) plus two calculated wrong solutions (err1 and err2). I am using this code:
sc <- num_to_schoice(res, digits=3, wrong=c(err1, err2))
I do get the five options generated, one with the correct solution (res), but none of the other four options include err1 and err2. Reading the num_to_choice documentation I find:
"The wrong solutions can be provided or are generated randomly. If wrong is provided only up to 2 elements of it are used in order to assure some random solutions."
However, in my case none of the err1 or err2 options are included in the sc$questions. What am I missing here? How can I force the err options to be included in the sc$questions?
Here is an reproducible example:
v <- c(1225,4000,1372,974,956,940,1532,969,1070,685,220,407,903,239,283,368,483,352,77,699)
res <- sd(v)
err1 <- IQR(v)
err2 <- sqrt(var(v)*(length(v-1)/length(v)))
set.seed(1)
sc <- num_to_schoice(res, digits=3, wrong=c(err1, err2), range=c(0,max(v)))
and here is the solution generated by sc$questions:
The result is "specified 'wrong' is too small for 'delta'"