Background
R/exams is a great tool for generating exams for students.
Problem
When a numeric exercise has a large tolerance (extol
), an error is thrown:
Error in if (!is.null(extol) && any(extol < 0)) { :
missing value where TRUE/FALSE needed
Is this a bug or am I missing something out?
Minimal example
Here's a minimal exercise that provoked the error:
Question
========
Some text
Solution
========
Some solution
```{r}
sol <- 1e4
sol_tol <- 1e4
```
Meta-information
================
exname: test-debug
extype: num
exsolution: `r fmt(sol, 3)`
extol: `r sol_tol`
I used exams2html to render the exercise:
exams2html(file = "test-debug.Rmd",
edir = "exercises",
dir = "/.")
System info
exams 2.4-0
extol
containsNA
values. This is not related to it being large. (I'm not familar with the exams package.)knitr
switched to scientific notation and then the tolerance cannot be corrected to numeric. Addingfmt()
should do the trick. Will check when I'm on a computer.fmt()
did the trick. Thanks a lot!NA
s insol_tol
orextol
.