This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
itan <- function(x, keys=NULL, digits=3, no.resp=4) { | |
# x is an n subjects by k items matrix | |
# keys is a vector with the correct keys (A, B, C, D) | |
stopifnot(ncol(x)>1) | |
if (is.null(keys)) keys <- rep("A", ncol(x)) | |
require(ltm) | |
raw.resp <- matrix(nr=ncol(x), nc=no.resp) | |
colnames(raw.resp) <- LETTERS[1:no.resp] | |
for (i in 1:ncol(x)) { | |
tmp <- table(x[,i]) |