Learn R Programming

exams (version 2.4-1)

nops_fix: Fix Data from Scanned NOPS Exams

Description

Fix scanned NOPS exams produced with nops_scan and update the corresponding ZIP file.

Usage

nops_fix(scans = dir(pattern = "^nops_scan_[[:digit:]]*\\.zip$"),
    exam = NULL, id = NULL, field = NULL, answer = NULL, check = NULL, display = NULL)

Value

Data frame with one line per scanned file is returned invisibly. The output contains the following columns: file name, sheet ID (11 digits), scrambling (2 digits), type of sheet (3 digits, coding the number of questions rounded up to steps of 5 and the length of the registration number), 0/1 indicator whether the replacement sheet was used, registration number (7-10 digits), 45 multiple choice answers of length 5 (all 00000 if unused).

Arguments

scans

character. File name of the ZIP file with scanning results (containing Daten.txt and PNG files) as produced by nops_scan.

exam

integer. Rows number from the scanned data which should (potentially) be fixed (default: all rows).

id

integer or character. Either a vector with full 11-digit exam IDs for the exams to be checked. Or the last five digits of the full 11-digit ID (where leading zeros can be omitted).

field

character indicating which field(s) from the scanned data should be fixed. One or more of "type" (3-digit exam sheet type), "id" (11-digit exam ID), "registration" (registration ID, can be between 7 and 10 digits), "answers" (individual answer checkboxes). By default all fields with invalid entries have to be fixed.

answer

integer indicating which answer checkboxes should (potentially) be fixed if field contains "answers" (default: all answers).

check

character indicating additional check conditions for the answers: If set to "missing" only the missing answers are considered. For "schoice" answers with more than one checked box are considered. For "mchoice" answers with all boxes checked are considered.

display

character indicating how the scanned image should be displayed. One or both of "plot" (display scanned excerpt in R plot) and "browser" (display full scanned image in browser). By default "plot" is used if the png package is available and "browser" otherwise.

Details

nops_fix is a companion function for exams2nops and nops_scan. To fix problems that potentially occurred when extracting the exam information from the scanned PDF/PNG images, nops_fix can iterate through the scanned data and interactively prompt for fields that (potentially) need to be fixed. Typical cases are when errors occurred in entering the registration ID or when the entire exam sheet could not be read correctly. See below for a couple of typical application examples.

For each specified field the user is prompted for a potential update. By just pressing ENTER the current value of the field is preserved. If an update is not a valid specification of the field, the prompt is repeated (along with some additional instructions) until a valid specification is entered by the user.

The type of sheed needs to be a 3-digit number, the exam ID needs to be an 11-digit number, and the registration ID needs to be a number with 7-10 digits.

All answer fields eventually store the multiple-choice answers with 0/1 indicators of length 5. The following input formats are accepted:

  • 0/1 indicators of length up to 5. If less then 5 digits are specified, the remaining digits are filled with 0s.

  • Letters from a to e indicating the box(es) that have been checked.

  • Integers from 1 to 5 indicating which single box has been checked.

  • No checked box can be indicated by "0", "-", or " ".

See Also

exams2nops, nops_scan, nops_eval

Examples

Run this code
## typical application cases (not run), all assume that there is
## a single nops_scan_*.zip file in the current working directory

## fix all rows/fields that can be detected as incorrect
## nops_fix()

## fix answer 6 in exam 3
## nops_fix(exam = 3, answer = 6)

## fix all answers in exam 3
## nops_fix(exam = 3, field = "answers")  

## fix all fields exam 3
## nops_fix(exam = 3, field = c("type", "id", "registration", "answers"))

## fix answer 6 in exam with id 23112900129
## nops_fix(id = "23112900129", answer = 6)
## nops_fix(id = 129, answer = 6)

## fix all answers in questions 1 to 8 where more than one box was checked
## nops_fix(answer = 1:8, check = "schoice")

Run the code above in your browser using DataLab