I was using the MCA() function from FactoMineR package in R to do the multiple correspondence analysis on a set of around 160 variables with around 2000 observations. Around 150 of the variables are continuous, so I first used the cut() function to convert those continuous variables to categorical variables and then used MCA() function.
My code is very simple like this:
library(FactoMineR)
data<-read.csv('demographics.csv')
for (i in 9:length(data)){
temp<-unlist(data[i],use.names=FALSE)
data[i]<-cut(temp,breaks=5,labels=c('A','B','C','D','E'))
}
MC<-MCA(data,ncp=10,graph=TRUE)
After I run the code, I got the following error message.
Error in dimnames(res) <- list(attributes(tab)$row.names, listModa) : length of 'dimnames' [2] not equal to array extent
I am wondering why this error occurs and how to fix it. There is no missing data in my table and all of the variables are categorical.
If anyone has encountered similar problems and would love to help, I would really appreciate it. Thanks a lot.