The exams package

R
Teaching
Author

Michael

Published

June 11, 2016

I gave the R package exams a shot for my decision making lecture. Here is what it does:

“Automatic generation of exams based on exercises in Sweave (R/LaTeX) or R/Markdown format, including multiple-choice questions and arithmetic problems. Exams can be produced in various formats, including PDF, HTML, Moodle XML, QTI 1.2 (for OLAT/OpenOLAT), QTI 2.1, ARSnova, and TCExam. In addition to fully customizable PDF exams, a standardized PDF format is provided that can be printed, scanned, and automatically evaluated.”

After some fiddling and help from one of the authors (the incredible nice Achim Zeileis, Uni Innsbruck)  I got the following setup going:

There are three parts:

  1. questions[] defining the answers to a question
  2. solutions[] defining the correct answers
  3. in LaTeX the actual question

All of this information goes into an .Rmd file.

Once this is done one has to define the questions to be included (the pool) and set the details for the selection process:

sol <- exams2pdf(myexam, 
n = 2, 
nsamp = 5, 
dir = odir, 
 template = c("my_exam", "solution"), 
 encoding = 'UTF-8',
 header = list(Date = "10.06.2016")
)

This code would give me 2 exams with a sample of 5 questions out of each block of questions.

Pretty awesome (after some setup work).

Thanks Achim et al. !!