CRAN Release of R/exams 2.3-2
R/exams on CRAN screenshot (CC-BY).

CRAN Release of R/exams 2.3-2

New minor release of the R/exams package to CRAN, containing a range of smaller improvements and bug fixes. Notably scanning of written NOPS exams is enhanced and made more reliable and a new exercise template demonstrates how to use advanced processing of numeric answers in Moodle.

Version 2.3-2 of the one-for-all exams generator R/exams has been published on the Comprehensive R Archive Network at In the next days this will propagate to other CRAN mirrors along with Windows and OS X binary packages. The development version of the package is now version 2.3-3 on R-Forge at

Written exams (NOPS)

  • Support for further languages is available in exams2nops() and nops_eval(): Russian (ru, contributed by Boris Demeshev) and Serbian (sr, contributed by Tatjana Kecojevic). Furthermore, Croatian (hr) was streamlined along with Serbian by Tatjana Kecojevic.
  • In exams2nops() the header argument can also be specified simply as header = "\\mycommand{value}" rather than header = list(mycommand = "value"). The former is more flexible, e.g., for passing additional options or more complex commands. Internally, the former is turned into an unnamed list which is then processed correspondingly by exams2pdf().
  • Scanning of written NOPS exams is enhanced and registration IDs are processed more reliably: First, nops_scan() gained a new argument trim = 0.3 that controls how much of the check boxes is trimmed in order to shave the borders prior to determining the average gray level. In versions up to 2.3-1 this implicitly had a value of 0.25 hard-coded. Now the default increased to 0.3 in order to shave box borders more reliably, e.g., in more pixelated scans. Second, nops_scan() tries to process registration numbers more reliably. In case one of the registration columns contains more than one potential mark, the heuristics of determining the intended mark have been improved.
  • nops_eval() gained a new argument labels = NULL that can be used to give labels for the marks that differ from the default (length(mark) + 1):1.

New exercise templates

  • The new exercise confint3 (Rmd/Rnw) illustrates how to use the verbatim type for advanced processing in Moodle when asking for the computation of a 2-sided confidence interval. Rather than using a single correct value for each numeric result (along with a corresponding tolerance interval) as in num exercises (see confint2), the exercise also provides a second partially correct value for each result. More precisely, the exercise yields 100% of the points for the correct solution based on t quantiles but still 50% for the solution based on normal quantiles. This is possible by setting the type to verbatim and specifying the solution via the necessary Moodle XML markup directly, e.g., :NUMERICAL:=<value1>:<tolerance1>~%50%<value2>:<tolerance2>#<comment>. The exercise is a contribution by Ulrike Groemping.


  • Rather than fully importing the basic dependencies stats, graphics, grDevices, tools, and utils, only the required functions from those packages are imported selectively. The main motivation for this was that otherwise the code evaluated in R/exams exercises might also use the same NAMESPACE semantics as the exams package - instead of employing the setup in the user’s environment. The issue was raised in this StackOverflow thread by Florian Oswald.
  • In include_supplement() an argument target = NULL is added to optionally include the supplement with a different file name than the original file name.
  • In all LaTeX templates that use Helvetica (phv) as the font for the main text, this is also used now in math mode by \usepackage[helvet]{sfmath} (rather than \usepackage{sfmath}, as employed previously). In particular, this affects exams2nops() and tex2image() output.

Bug fixes

  • In previous versions the pandoc-based HTML converter erroneously produced unbalanced <p> tags in certain situations.
  • The QTI 2.1 XML output from exams2qti21() is somewhat cleaner, fixing some computations for correct/incorrect answers in schoice/mchoice exercises.