Skip to content

fviz_contrib is not plotting FAMD output #184

@aravind-j

Description

@aravind-j

fviz_contrib is not plotting FAMD output, both for qualitative and quantitative variables.

For qualitative variables, it is because factor levels of different variables are same. This is related to #140 .

library(FactoMineR)
library(factoextra)
library(EvaluateCore)
data(cassava_EC)

quant <- c("NMSR", "TTRN", "TFWSR", "TTRW", "TFWSS", "TTSW", "TTPW", "AVPW",
           "ARSR", "SRDM")
qual <- c("CUAL", "LNGS", "PTLC", "DSTA", "LFRT", "LBTEF", "CBTR", "NMLB",
          "ANGB", "CUAL9M", "LVC9M", "TNPR9M", "PL9M", "STRP", "STRC",
          "PSTR")

cassava_EC[, qual] <- lapply(cassava_EC[, qual], as.factor)


res.FAMD <- FAMD(base = cassava_EC, graph = FALSE)

fviz_contrib(res.FAMD, choice = "quanti.var")
# Error in -nrow(X$group$Lg) : invalid argument to unary operator
# Calls: fviz_contrib ... .get_quanti_var_groups -> data.frame -> rownames -> %||%

fviz_contrib(res.FAMD, choice = "quali.var")
# Error in `.rowNamesDF<-`(x, value = value) : 
#   duplicate 'row.names' are not allowed
# Calls: fviz_contrib ... row.names<- -> row.names<-.data.frame -> .rowNamesDF<-
# In addition: Warning message:
# non-unique values when setting 'row.names': ‘Dark green’, ‘Green purple’, ‘Light green’, ‘Purple’ 


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions