Search code examples
ranalysis

Error in dimnames(res) of MCA (FactoMineR)


i am doing MCA with FactoMineR but always have the same error message!

This is my data valqualis to be analysed. 156 rows and 20 columns.

P1 20 4.708846 111  11 0011 0010 11  1 1 1 0 1 1 1 1 1 1 1 1
P1 3  4.790977 10NA 10 0111 0001 0NA 1 1 0 1 1 1 1 1 1 1 0 0 

And this is the code I am doing to run it.

require(FactoMineR)
require(factoextra)

#ACM
res.mca<-MCA(valqualis) 

But each time I have the following error:

Error in dimnames(res) <- list(attributes(tab)$row.names, listModa) : length of 'dimnames' [2] not equal to array extent

Any ideas?


Solution

  • Finally, I found the cause of the error!

    After doing summary(valqualis) I found that I had 2 columns which included quantitative values, so I changed them into factor with the following code:

    valqualis$X1 <- as.factor(valqualis$X1)
    valqualis$X2 <- as.factor(valqualis$X2)
    

    Thank you!