mat <- matrix(nrow = 4, ncol = 4, data = NA)
# The category PCM matrix
rownames(mat) <- c('excellent','good','fair','poor')
colnames(mat) <- c('excellent','good','fair','poor')
mat[1,] <- c(1,2,4,6)
mat[2,] <- c(NA,1,2,4)
mat[3,] <- c(NA,NA,1,2)
mat[4,] <- c(NA,NA,NA,1)
# The alternative matrix
alt <- matrix(nrow = 5, ncol = 2, data = NA)
alt[,1] <- c("Andy", "Emily", "Nina", "Alex", "Jack")
alt[,2] <- c("good", "poor", "good", "fair", "excellent")
result <- rating(mat, alt, simulation = 500)
# Specifying a category with value of zero
alt <- rbind(alt, c('shannon', 'Not_available'))
result <- rating(mat, alt, NA_category = 'Not_available', simulation = 500)
Run the code above in your browser using DataLab