I'm studying PCA method with the package PCAmixdata because I have a dataset with numerical and categorical variable. This is my example code in R:


data <- starwars
db_quali <- as.data.frame(starwars[,4:6])
db_quanti <- as.data.frame(starwars[,2:3])

pca_table <- PCAmix(X.quanti = db_quanti,
                    X.quali = db_quali,
                    graph = TRUE)
Gender <- factor(data$gender)

plot(pca_table ,choice="ind",label=FALSE,
     posleg=xy.coords(2,-10), main="Observations", coloring.ind = Gender)

I know that the function ggplot can be used only with data.frame and at the moment I have a list. Is there a way to convert pca_table into a data.frame to use the function ggplot?

I want to do this because in my original dataset I have many classes and with the function plot I have a limited set of colors, so a color could correspond to more than one class.



Browse other questions tagged or ask your own question.