简体   繁体   English

R误差中的因子分析混合数据

[英]Factor Analysis Mixed Data in R error

I am trying to run Factor Analysis Mixed Data in R on a dataframe and using the following command: 我正在尝试在数据帧上使用R运行因子分析混合数据,并使用以下命令:

res.famd <- FAMD(df, graph = FALSE)

But I am getting the following error: 但是我收到以下错误:

Error in which(unlist(lapply(listModa, is.numeric))) : argument to 'which' is not logical 错误((unlist(lapply(listModa,is.numeric))):错误的参数

I checked with: 我检查了:

str(df)

And I get the following: 我得到以下信息:

Gender : chr "M" "M" "M" "M" ... 性别:chr“ M”“ M”“ M”“ M” ...
Group : chr "LOW" "LOW" "LOW" "LOW" ... 组:chr“ LOW”“ LOW”“ LOW”“ LOW” ...
A : num 3.86e-09 1.90e-091.86e-09 3.63e-09 1.73e-09 ... A:编号3.86e-09 1.90e-091.86e-09 3.63e-09 1.73e-09 ...
B : num 2.32e-05 5.69e-06 1.86e-05 1.45e-05 1.04e-05 ... B:编号2.32e-05 5.69e-06 1.86e-05 1.45e-05 1.04e-05 ...
C : num 0.00249 0.00385 0.01555 0.00853 0.00426 ... C:编号0.00249 0.00385 0.01555 0.00853 0.00426 ...

I am trying to convert my variables to a factors but not sure whether I need to do so. 我正在尝试将变量转换为因子,但不确定是否需要这样做。 I am following the link below where it says that FAMD works with both character and numeric variables: http://www.sthda.com/english/articles/31-principal-component-methods-in-r-practical-guide/115-famd-factor-analysis-of-mixed-data-in-r-essentials/ 我在下面的链接中指出FAMD可以使用字符变量和数字变量: http : //www.sthda.com/english/articles/31-principal-component-methods-in-r-practical-guide/115在r要素中混合数据的famd因子分析/

Have you tried converting char variables to factors. 您是否尝试过将char变量转换为因数。

Ie

df$Gender<- as.factor(df$Gender)
df$Group<- as.factor(df$Group)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM