correct: Scoring correct/incorrect answers

View source: R/correct.R

correctR Documentation

Scoring correct/incorrect answers

Description

Transforms a data frame or matrix with raw answers into a data frame with 1s (correct answers) and 0s (incorrect answers).

Usage

correct(x, key, navalue = NA)

Arguments

x

a data frame or matrix.

key

a vector indicating the keys to score the data.

navalue

a single value indicating the score of NAs.

Value

A data frame with 1s for correct answers and 0s for incorrect answers.

Examples

data(dichodata)
data(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)



classicaltest documentation built on Oct. 28, 2024, 5:06 p.m.