tam_downcode | R Documentation |
Recodes item categories in a data frame such that each item has values
0,1,\ldots,K_i
.
tam_downcode(dat)
dat |
Data frame containing item responses |
List with following entries
dat |
Recoded dataset |
rec |
Recoding table |
#############################################################################
# EXAMPLE 1: Downcoding in a toy example
#############################################################################
#-- simulate some toy data
set.seed(989)
# values to be sampled
vals <- c(NA, 0:6)
# number of persons and items
N <- 10; I <- 5
dat <- as.data.frame(matrix(NA, nrow=N, ncol=I))
colnames(dat) <- paste0("I",1:I)
for (ii in 1L:I){
dat[,ii] <- sample(vals, size=N, replace=TRUE)
}
#-- apply downcoding
res <- TAM::tam_downcode(dat)
dat <- res$dat # extract downcoded dataset
rec <- res$rec # extract recoded table
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.