I have 200 observations with 6 features each, and I am trying to color the first 100 observations a different color than the second 100 observations. This is for principal component analysis. I have to insert some code with "col" inside my code but I do not know how to do this. Can anyone help? Thanks!
biplot(pr.out,scale=0,col=?)
The above comments are good advice, but the answer to your question is that you cannot use more than one color for the observations in the version of biplot
in the stats
package (see manual pages ?biplot.prcomp
and ?biplot.default
). You can use different symbols however:
PCA <- prcomp(USArrests, scale = TRUE)
sym <- c(rep("x", 25), rep("o", 25))
biplot(PCA, scale=0, xlabs=sym)
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.