I get that, too. What I'd try is to retrace the steps from the text's example code to see how it differs from what you are trying to derive, which will illuminate what may need to change in how you are trying to do it.
library(FactoMineR)
tea <- read.table("http://factominer.free.fr/book/tea.csv",header=TRUE,sep=";")
summary(tea)
#> breakfast afternoon.tea evening after.lunch
#> Length:300 Length:300 Length:300 Length:300
#> Class :character Class :character Class :character Class :character
#> Mode :character Mode :character Mode :character Mode :character
#>
#>
#>
#> after.dinner anytime home work
#> Length:300 Length:300 Length:300 Length:300
#> Class :character Class :character Class :character Class :character
#> Mode :character Mode :character Mode :character Mode :character
#>
#>
#>
#> tearoom friends restaurant pub
#> Length:300 Length:300 Length:300 Length:300
#> Class :character Class :character Class :character Class :character
#> Mode :character Mode :character Mode :character Mode :character
#>
#>
#>
#> variety how sugar format
#> Length:300 Length:300 Length:300 Length:300
#> Class :character Class :character Class :character Class :character
#> Mode :character Mode :character Mode :character Mode :character
#>
#>
#>
#> place.of.purchase type sex profession
#> Length:300 Length:300 Length:300 Length:300
#> Class :character Class :character Class :character Class :character
#> Mode :character Mode :character Mode :character Mode :character
#>
#>
#>
#> sport age age_Q frequency
#> Length:300 Min. :15.00 Length:300 Length:300
#> Class :character 1st Qu.:23.00 Class :character Class :character
#> Mode :character Median :32.00 Mode :character Mode :character
#> Mean :37.05
#> 3rd Qu.:48.00
#> Max. :90.00
#> exotic spirituality good.for.health diuretic
#> Length:300 Length:300 Length:300 Length:300
#> Class :character Class :character Class :character Class :character
#> Mode :character Mode :character Mode :character Mode :character
#>
#>
#>
#> friendliness iron.absorption feminine refined
#> Length:300 Length:300 Length:300 Length:300
#> Class :character Class :character Class :character Class :character
#> Mode :character Mode :character Mode :character Mode :character
#>
#>
#>
#> slimming stimulant relaxant no.effect.health
#> Length:300 Length:300 Length:300 Length:300
#> Class :character Class :character Class :character Class :character
#> Mode :character Mode :character Mode :character Mode :character
#>
#>
#>
res.mca<-MCA(tea, quanti.sup=22, quali.sup=c(19:21,23:36))
#> Warning: ggrepel: 31 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
plot(res.mca,invisible=c("var","quali.sup"),cex=0.7)
plot(res.mca,invisible=c("ind","quali.sup"))
#> Warning: ggrepel: 26 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
plot(res.mca,invisible="quali.sup")
plot(res.mca,invisible="ind")
plot(res.mca,invisible=c("ind","var"))
#> Warning: ggrepel: 24 unlabeled data points (too many overlaps). Consider
#> increasing max.overlaps
round(res.mca$eig,2)
#> eigenvalue percentage of variance cumulative percentage of variance
#> dim 1 0.15 9.88 9.88
#> dim 2 0.12 8.10 17.99
#> dim 3 0.09 6.00 23.99
#> dim 4 0.08 5.20 29.19
#> dim 5 0.07 4.92 34.11
#> dim 6 0.07 4.76 38.87
#> dim 7 0.07 4.52 43.39
#> dim 8 0.07 4.36 47.74
#> dim 9 0.06 4.12 51.87
#> dim 10 0.06 3.90 55.77
#> dim 11 0.06 3.81 59.57
#> dim 12 0.05 3.63 63.20
#> dim 13 0.05 3.46 66.66
#> dim 14 0.05 3.25 69.91
#> dim 15 0.05 3.22 73.13
#> dim 16 0.05 3.13 76.26
#> dim 17 0.05 3.04 79.30
#> dim 18 0.04 2.68 81.98
#> dim 19 0.04 2.54 84.52
#> dim 20 0.04 2.44 86.96
#> dim 21 0.04 2.38 89.34
#> dim 22 0.03 2.32 91.66
#> dim 23 0.03 2.06 93.72
#> dim 24 0.03 1.92 95.63
#> dim 25 0.03 1.82 97.45
#> dim 26 0.02 1.41 98.86
#> dim 27 0.02 1.14 100.00
lapply(dimdesc(res.mca),lapply,round,4)
#> Error in Math.data.frame(structure(list(`Dim 1` = c(-0.541014547284892, : non-numeric-alike variable(s) in data frame: breakfast, afternoon.tea, evening, after.lunch, after.dinner, anytime, home, work, tearoom, friends, restaurant, pub, variety, how, sugar, format, place.of.purchase, type, sex, profession, sport, age_Q, frequency, exotic, spirituality, good.for.health, diuretic, friendliness, iron.absorption, feminine, refined, slimming, stimulant, relaxant, no.effect.health
lapply(dimdesc(res.mca),lapply,signif,3)
#> Error in Math.data.frame(structure(list(`Dim 1` = c(-0.541014547284892, : non-numeric-alike variable(s) in data frame: breakfast, afternoon.tea, evening, after.lunch, after.dinner, anytime, home, work, tearoom, friends, restaurant, pub, variety, how, sugar, format, place.of.purchase, type, sex, profession, sport, age_Q, frequency, exotic, spirituality, good.for.health, diuretic, friendliness, iron.absorption, feminine, refined, slimming, stimulant, relaxant, no.effect.health
plotellipses(res.mca,keepvar=c("relaxant","restaurant","profession","place.of.purchase"))
res.mca <- MCA(tea, quanti.sup=22, quali.sup=c(19:21,23:36), graph=FALSE)
new.data <- cbind.data.frame(tea[,11],res.mca$ind$coord)
res.pca <- PCA(new.data,quali.sup=1,scale=FALSE,graph=FALSE)
res.pca$eig[1:5,]=res.mca$eig[1:5,]
concat.data <- cbind.data.frame(tea[,11],res.mca$ind$coord)
ellipse.coord <- coord.ellipse(concat.data,bary=TRUE)
#> Error in if (scale[1] > 0) r <- r/scale[1]: missing value where TRUE/FALSE needed
plot.PCA(res.pca, habillage=1, ellipse=ellipse.coord, cex=0.8,label="none")
#> Error in plot.PCA(res.pca, habillage = 1, ellipse = ellipse.coord, cex = 0.8, : object 'ellipse.coord' not found
catdes(tea, num.var = 18)
#>
#> Link between the cluster variable and the categorical variables (chi-square test)
#> =================================================================================
#> p.value df
#> place.of.purchase 1.109612e-18 10
#> format 8.441989e-11 10
#> tearoom 1.672882e-03 5
#> friends 4.271608e-02 5
#> slimming 4.329224e-02 5
#> variety 4.963497e-02 10
#>
#> Description of each cluster by the categories
#> =============================================
#> $cheapest
#> NULL
#>
#> $known.brand
#> Cla/Mod Mod/Cla Global
#> place.of.purchase=supermarket 42.708333 86.315789 64.00000
#> format=sachet 41.176471 73.684211 56.66667
#> tearoom=not.tearoom 36.363636 92.631579 80.66667
#> profession=employee 47.457627 29.473684 19.66667
#> sport=not.sporty 38.842975 49.473684 40.33333
#> good.for.health=good for health 35.238095 77.894737 70.00000
#> profession=senior management 17.142857 6.315789 11.66667
#> good.for.health=not.good for health 23.333333 22.105263 30.00000
#> sport=sporty 26.815642 50.526316 59.66667
#> format=loose 13.888889 5.263158 12.00000
#> format=sachet+loose 21.276596 21.052632 31.33333
#> place.of.purchase=specialist.shop 6.666667 2.105263 10.00000
#> tearoom=tearoom 12.068966 7.368421 19.33333
#> place.of.purchase=supermarket+specialist. 14.102564 11.578947 26.00000
#> p.value v.test
#> place.of.purchase=supermarket 1.266805e-08 5.690483
#> format=sachet 4.473843e-05 4.081539
#> tearoom=not.tearoom 1.794356e-04 3.746337
#> profession=employee 4.834575e-03 2.817854
#> sport=not.sporty 2.981255e-02 2.172572
#> good.for.health=good for health 4.155241e-02 2.037975
#> profession=senior management 4.597973e-02 -1.995579
#> good.for.health=not.good for health 4.155241e-02 -2.037975
#> sport=sporty 2.981255e-02 -2.172572
#> format=loose 1.158619e-02 -2.524503
#> format=sachet+loose 8.370027e-03 -2.636767
#> place.of.purchase=specialist.shop 8.371610e-04 -3.340207
#> tearoom=tearoom 1.794356e-04 -3.746337
#> place.of.purchase=supermarket+specialist. 5.845313e-05 -4.018970
#>
#> $luxury
#> Cla/Mod Mod/Cla Global
#> place.of.purchase=specialist.shop 70.000000 39.62264 10.00000
#> format=loose 55.555556 37.73585 12.00000
#> variety=black 28.378378 39.62264 24.66667
#> age_Q=60 and + 31.578947 22.64151 12.66667
#> no.effect.health=no.effect.health 27.272727 33.96226 22.00000
#> tearoom=tearoom 27.586207 30.18868 19.33333
#> place.of.purchase=supermarket+specialist. 25.641026 37.73585 26.00000
#> tearoom=not.tearoom 15.289256 69.81132 80.66667
#> no.effect.health=not.without.effect.health 14.957265 66.03774 78.00000
#> variety=flavoured 12.435233 45.28302 64.33333
#> age_Q=15-24 7.608696 13.20755 30.66667
#> format=sachet 8.235294 26.41509 56.66667
#> place.of.purchase=supermarket 6.250000 22.64151 64.00000
#> p.value v.test
#> place.of.purchase=specialist.shop 1.665291e-11 6.732712
#> format=loose 3.094223e-08 5.536020
#> variety=black 7.934470e-03 2.654846
#> age_Q=60 and + 2.532323e-02 2.236436
#> no.effect.health=no.effect.health 2.694825e-02 2.212267
#> tearoom=tearoom 3.585918e-02 2.098521
#> place.of.purchase=supermarket+specialist. 3.849553e-02 2.069539
#> tearoom=not.tearoom 3.585918e-02 -2.098521
#> no.effect.health=not.without.effect.health 2.694825e-02 -2.212267
#> variety=flavoured 1.928697e-03 -3.100998
#> age_Q=15-24 1.569371e-03 -3.161540
#> format=sachet 1.140733e-06 -4.865664
#> place.of.purchase=supermarket 1.444316e-11 -6.753388
#>
#> $shop.brand
#> Cla/Mod Mod/Cla Global
#> place.of.purchase=supermarket 10.416667 95.238095 64
#> place.of.purchase=supermarket+specialist. 1.282051 4.761905 26
#> p.value v.test
#> place.of.purchase=supermarket 0.0008502018 3.335912
#> place.of.purchase=supermarket+specialist. 0.0139850954 -2.457646
#>
#> $unknown
#> Cla/Mod Mod/Cla Global p.value v.test
#> format=sachet 6.470588 91.66667 56.66667 0.01087617 2.546653
#> how=milk 9.523810 50.00000 21.00000 0.02635851 2.220889
#>
#> $varies
#> Cla/Mod Mod/Cla Global
#> place.of.purchase=supermarket+specialist. 56.41026 39.285714 26.00000
#> format=sachet+loose 52.12766 43.750000 31.33333
#> friends=friends 43.36735 75.892857 65.33333
#> after.lunch=after.lunch 56.81818 22.321429 14.66667
#> tearoom=tearoom 51.72414 26.785714 19.33333
#> slimming=not.slimming 40.00000 91.071429 85.00000
#> variety=flavoured 41.96891 72.321429 64.33333
#> place.of.purchase=specialist.shop 20.00000 5.357143 10.00000
#> format=sachet 31.76471 48.214286 56.66667
#> slimming=slimming 22.22222 8.928571 15.00000
#> place.of.purchase=supermarket 32.29167 55.357143 64.00000
#> tearoom=not.tearoom 33.88430 73.214286 80.66667
#> after.lunch=not.after.lunch 33.98438 77.678571 85.33333
#> friends=not.friends 25.96154 24.107143 34.66667
#> p.value v.test
#> place.of.purchase=supermarket+specialist. 7.141311e-05 3.971528
#> format=sachet+loose 4.236418e-04 3.524901
#> friends=friends 2.880745e-03 2.980185
#> after.lunch=after.lunch 4.905579e-03 2.813169
#> tearoom=tearoom 1.356760e-02 2.468512
#> slimming=not.slimming 2.154609e-02 2.298276
#> variety=flavoured 2.586794e-02 2.228189
#> place.of.purchase=specialist.shop 3.659540e-02 -2.090249
#> format=sachet 2.370215e-02 -2.261923
#> slimming=slimming 2.154609e-02 -2.298276
#> place.of.purchase=supermarket 1.730140e-02 -2.380239
#> tearoom=not.tearoom 1.356760e-02 -2.468512
#> after.lunch=not.after.lunch 4.905579e-03 -2.813169
#> friends=not.friends 2.880745e-03 -2.980185
Created on 2023-03-05 with reprex v2.0.2