mult.choice: Multiple Choice Items to Binary Responses

Description Usage Arguments Value Author(s) Examples

View source: R/mult.choice.R

Description

It converts multiple choice items to a matrix of binary responses.

Usage

1
mult.choice(data, correct)

Arguments

data

a matrix or a data.frame containing the manifest variables as columns.

correct

a vector of length ncol(data) with the correct responses.

Value

a matrix of 0/1 values indicating wrong/correct answers.

Author(s)

Dimitris Rizopoulos [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dat <- data.frame(It1 = sample(4, 100, TRUE),
                  It2 = sample(4, 100, TRUE),
                  It3 = sample(5, 100, TRUE),
                  It4 = sample(5, 100, TRUE),
                  It5 = sample(4, 100, TRUE),
                  It6 = sample(5, 100, TRUE))
dat[] <- lapply(dat, function (x) { x[sample(100, 4)] <- NA; x })
crct <- c(3, 2, 5, 3, 4, 5)
####################
mult.choice(dat, crct)

drizopoulos/ltm documentation built on April 19, 2018, 2:37 a.m.