score_items: Score multiple choice items

View source: R/psychometrics.R

score_itemsR Documentation

Score multiple choice items

Description

Score a data.frame with multiple choice items using an answer key. Each column has a answers for one question.

Usage

score_items(df, key)

Arguments

df

(data.frame) A data.frame with responses.

key

(vector) A vector with the correct responses.

Details

Returns a data.frame of the same size as that given with the values 0 representing incorrect answers and 1 representing correct answers.

Examples

library(psych) #for ICAR data
d = score_items(iqitems, c(4,4,4, 6,  6,3,4,4,   5,2,2,4,   3,2,6,7)) #score and save
psych::alpha(d) #examine internal consistency

Deleetdk/kirkegaard documentation built on April 1, 2024, 2:23 a.m.