简体   繁体   中英

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:

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

I checked with:

str(df)

And I get the following:

Gender : chr "M" "M" "M" "M" ...
Group : chr "LOW" "LOW" "LOW" "LOW" ...
A : num 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 ...
C : num 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/

Have you tried converting char variables to factors.

Ie

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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