View source: R/psychometrics.R
score_items | R Documentation |
Score a data.frame with multiple choice items using an answer key. Each column has a answers for one question.
score_items(df, key)
df |
(data.frame) A data.frame with responses. |
key |
(vector) A vector with the correct responses. |
Returns a data.frame of the same size as that given with the values 0 representing incorrect answers and 1 representing correct answers.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.