[R] Error in using multiple correspondence analysis in R's FactoMineR

Luigi Marongiu m@rong|u@|u|g| @end|ng |rom gm@||@com
Sun Jan 9 09:15:54 CET 2022


Hello,
I am trying to apply multiple correspondence analysis to a data frame
using the FactoMineR package following the post
http://sebastien.ledien.free.fr/unofficial_factominer/factosbest/dimensions-description.html

My data frame has this structure:
```
> str(df)
'data.frame': 27 obs. of  33 variables:
$ id              : int  1 6 9 10 11 12 13 36 40 49 ...
$ retinol         : num  2.56 2.93 3.21 1.73 1.32 2.34 2.43 2.54 0.37 1.22 ...
...
$ age             : int  60 63 66 72 64 73 66 68 72 59 ...
$ death           : Factor w/ 2 levels "No","Yes": 1 2 1 1 2 1 1 2 1 1 ...
...
$ age_bin         : Factor w/ 4 levels "<30","30-49",..: 3 3 3 4 3 4 3 3 4 3 ...
```
Thus, following the post, I have set the quantitative supplementary
column to `age` (df[10]) and then tested the factorial variables
(df[11:33) but:
```
> res.mca = MCA(df, quanti.sup=2, quali.sup=c(11:33))
Error in dimnames(res) <- list(attributes(tab)$row.names, listModa) :
length of 'dimnames' [2] not equal to array extent
> nrow(df[10])
[1] 27
> nrow(df[11:33])
[1] 27
```

What would be the problem?
Thank you


-- 
Best regards,
Luigi



More information about the R-help mailing list