| irtc_score | R Documentation |
Converts raw multiple-choice responses (e.g. "A", "B",
"C", "D") to 0/1 scores using an answer key, or maps
responses to partial-credit scores through a rules table. Responses are
normalised before matching: whitespace is trimmed, case is ignored and
full-width characters are converted to half-width.
Both key and rules may also be file paths in any format
supported by irtc_read. A key file needs an item column
(item, \zh题目\u9898\u76ee, ...) and an answer column
(answer, \zh答案\u7b54\u6848, ...); an optional
partial-answer column (partial_answer,
\zh部分正确答案\u90e8\u5206\u6b63\u786e\u7b54\u6848, ...)
lists answers worth partial credit, several separated by |,
;, , or \zh、\u3001. Items with partial
answers are scored full = 2, partial = 1, other = 0; items without stay
0/1. For more than three score levels supply an explicit rules
table instead.
irtc_score(resp, key = NULL, rules = NULL, na_as_wrong = FALSE,
sheet = 1)
resp |
An |
key |
A named vector mapping item names to correct answers, e.g.
|
rules |
A data frame with columns |
na_as_wrong |
Logical: score missing responses as 0 instead of
|
sheet |
Excel sheet of the key / rules file (number or name). |
The same type as the input: an irtc_data object with scored
resp and an extended log, or a data frame with a
"scoring_log" attribute.
irtc_read, irtc
resp <- data.frame(Q1 = c("A", "b", "C"), Q2 = c("c", "C", "D"),
stringsAsFactors = FALSE)
irtc_score(resp, key = c(Q1 = "A", Q2 = "C"))
rules <- data.frame(item = "Q1", response = c("A", "B", "C"),
score = c(2, 1, 0))
irtc_score(resp["Q1"], rules = rules)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.