correct | R Documentation |
Transforms a data frame or matrix with raw answers into a data frame with 1s (correct answers) and 0s (incorrect answers).
correct(x, key, navalue = NA)
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. |
A data frame with 1s for correct answers and 0s for incorrect answers.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.