# first a standard 1:m option selection
opchoice<-matrix(NA,nrow=40,ncol=5)
for(i in 1:40) opchoice[i,]<-sample(1:10,5)
cats2ranks(opchoice)
# now a messy character choice with missing values
opchoice<-matrix(NA,nrow=40,ncol=5)
for(i in 1:40) {
nchoices<-sample(3:5,1)
opchoice[i,1:nchoices]<-sample(LETTERS[1:10],nchoices)
}
cats2ranks(opchoice)
Run the code above in your browser using DataLab