# The exams package

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:

• pool of ~ 100 questions in .Rmd format (all multiple choice, 3-6 answer options) grouped into lectures
• sampling out of the pool (e.g., 5 questions out of each lecture)
• random order of questions in each version of the exam (while keeping the lecture order, which I think is useful to give student more structure to work from)
• random order of the answers for each question
• exam with the correct answers

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',
)

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. !!

##### Michael Schulte-Mecklenbeck
###### Associate Professor

I study human decision making, process tracing methods, food choice and traffic behavior.