# NOT RUN {
# Generate a data set consisting of 200 rows and 50 columns
# in which the values are integers between 1 and 3.
# Afterwards, remove 20 of the values randomly.
mat <- matrix(sample(3, 10000, TRUE), 200)
mat[sample(10000, 20)] <- NA
# Replace the missing values.
mat2 <- knncatimpute(mat)
# Replace the missing values using the 5 nearest neighbors
# and Cohen's Kappa.
mat3 <- knncatimpute(mat, nn = 5, dist = "cohen")
# }
Run the code above in your browser using DataLab