correct {classicaltest} | R Documentation |
Scoring correct/incorrect answers
Description
Transforms a data frame or matrix from raw answers to scores given a key.
Usage
correct(x, key, navalue = NA)
Arguments
x |
a data frame or matrix. |
key |
a vector or a list indicating the keys to score the data. If answers can only be right or wrong use a vector. If partial credits are allowed, use a list where the first element contains the keys for full credits, and next elements contain progressively the partial credit information. If a test has a combination of full credit and partial credit items, leave the full credit items as NAs in the keys for partial credit. |
navalue |
a single value indicating the score of NAs. |
Value
A data frame with scored answers.
Examples
# Full credit
dichokey
## NAs as NAs
head(dichodata)
ex1 <- correct(x = dichodata, key = dichokey, navalue = NA)
head(ex1)
## NAs as 0s
head(dichodata)
ex2 <- correct(x = dichodata, key = dichokey, navalue = 0)
head(ex2)
# Partial credit
partialkey
## NAs as NAs
head(partialdata)
ex3 <- correct(x = partialdata, key = partialkey, navalue = NA)
head(ex3)
## NAs as 0s
head(partialdata)
ex4 <- correct(x = partialdata, key = partialkey, navalue = 0)
head(ex4)
[Package classicaltest version 0.7.5 Index]