具有因子变量的FactoMineR PCA [英] FactoMineR PCA with factor variables

查看:466
本文介绍了具有因子变量的FactoMineR PCA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是R数据格式的数据链接(因此您可以看到因素实际上是因素):

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

疫苗接种数据2016

这是代码:

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

我很困惑.我不是说他们是定量的.我说过它们是quali.sup类型.你能复制吗?如果是这样,有什么解决方案?谢谢大家

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.

推荐答案

哦,亲爱的.原来我打错了.我应该说quali.sum变量是13:19,而我说它们是14.这就是问题所在.

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.

这篇关于具有因子变量的FactoMineR PCA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆