具有因子变量的FactoMineR PCA

时间:2018-09-01 23:56:06

标签: r debugging pca

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

Vaccination Data 2016

代码如下:

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

除了告诉我它用均值(我很高兴看到)替换了缺失的值外,上面的代码还产生了这样的结果:

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类型。你能复制吗?如果是这样,有什么解决方案?谢谢大家

1 个答案:

答案 0 :(得分:0)

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