After trying everything, I can't get out of it. I have some data in a data frame where the first column is names, the other three are integers. I would like to run the cluster and factoextra packages but procedures such as scalar are forbidden to me because they are found with the text variable. I would like this variable to appear in both text and graphic results. A little help please.
Microsoft OneDrive - Access files anywhere. Create docs with free Office Online. (bdn.xlsx)
Hi, @belluguet Welcome to Posit community.
I found a link that may be helpful to you. Like the example by seting the label and habillage? When scale, overlook the text column. Like the example code from the link. I am just an R beginner.
# Compute PCA on the iris data set
# The variable Species (index = 5) is removed
# before PCA analysis
iris.pca <- PCA(iris[,-5], graph = FALSE)
# Visualize
# Use habillage to specify groups for coloring
fviz_pca_ind(iris.pca,
label = "none", # hide individual labels
habillage = iris$Species, # color by groups
palette = c("#00AFBB", "#E7B800", "#FC4E07"),
addEllipses = TRUE # Concentration ellipses
)
Visualize Principal Component Analysis — fviz_pca • factoextra (datanovia.com)
Your goal seems at odds with general practice in this area, hence your struggle to make the tools work in the way you describe.
Can you motivate this with a simple example (without reference to data on onedrive?)
In the simplest example of wanting to scale the numeric data; you can simply divide the data, and recombine it after processing . like so:
(hiris <- head(iris))
# error
scale(hiris)
(scaled_hiris <- cbind(data.frame(scale(hiris[,-5])),
Species = hiris[,5]))
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.