Search code examples
rr-exams

Fill initial student IDs with zeros in R/exams exams2nops()


When using the exams package to produce PDF files for NOPS exams I want to edit the number of digits that are available to my students (reglength). I am aware that the package only admits a minimum of 7 digits. However, our students only have 5 digits in their ID number. As so I would to know if it is possible to edit the template via PDF manipulation (I tried with the staplr::get_fields() function, but it does not work) or any other way... I simply want to add 0to the two first digits (i.e., 00xxxxx).


Solution

  • This is a good idea which I have implemented in exams 2.4-0. If you specify a reglength < 7 now, it is still enforced to be 7 internally - and thus this length is necessary in the registration CSV file! But on the exam sheet the initial IDs are fixed to "0" and the corresponding boxes are ticked already.

    For example, the following code will give you a warning but produce the output below:

    exams2nops(..., reglength = 5)
    ## Warning message:
    ## In make_nops_page(n, nchoice = nchoice, reglength = reglength) :
    ##   'reglength = 5' too small, using 7 instead, but fixing initial IDs to 0
    

    exams2nops with reglength 5

    Notes:

    • I haven't tested yet whether the scanning of these sheets actually works well enough because I'm in my home office for the foreseeable future without access to a suitable printer/scanner. I don't see sources for potential problems, though.
    • I assumed that you referred to exams2nops() rather than exams2pdf() and hence have modified your question accordingly. In exams2pdf() you can need to provide your template anyway and can edit it in any way you like, adding the zeros where you need them.