FactoMineR PCA with factor variables

我是研究僧i 提交于 2020-01-15 09:23:28

问题


Here is a link to the data in R data format (so you can see that the factors are actually factors):

Vaccination Data 2016

Here is the code:

df %>%
   PCA(scale.unit = TRUE,
       quali.sup = 14, #the factor variables
       graph = T)

Aside from telling me that it replaced missing values with means (which I was happy to see), the above produces this:

argument is not numeric or logical: returning NA
argument is not numeric or logical: returning NA
argument is not numeric or logical: returning NA
argument is not numeric or logical: returning NA
argument is not numeric or logical: returning NA
argument is not numeric or logical: returning NA
Error in PCA(., scale.unit = TRUE, quali.sup = 14, graph = T) : 
    The following variables are not quantitative:  ins_stat_i
    The following variables are not quantitative:  c1r
    The following variables are not quantitative:  childnm
    The following variables are not quantitative:  state
    The following variables are not quantitative:  sex
    The following variables are not quantitative:  language

I'm confused. I didn't say they were quantitative. I said they were quali.sup types. Can you duplicate it? If so, what's the solution? Thanks, all.


回答1:


Oh dear. It turns out that I mistyped. I should have said the quali.sum variables were 13:19 and I said they were 14. That was the problem.



来源:https://stackoverflow.com/questions/52133009/factominer-pca-with-factor-variables

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!