Andy.P
2014-Jan-21 18:17 UTC
[R] PCA factominer package, question about changing labels in individuals factor map
I am looking to do a PCA with the factominer package on a dataset of mine, named dat. The individuals in my dataset have character names, represented in the first column of my dataset, but since they aren't quantitative I can't include that column in my PCA analysis. Leading to the command > res.pca = PCA(dat[,3:8], scale.unit=TRUE, ncp=5, graph=T) This is all well and good, except when my individuals factor map shows up, each data point is labeled as a number and not as their actual character names. <http://r.789695.n4.nabble.com/file/n4683924/Screen_Shot_2014-01-21_at_12.19.23_PM.png> How do I go about getting the map to display the character names? If I include the column with the names I get an error because it's not quantitative. I know it can be done because I've seen it on the decathlon dataset, I just don't know what they're doing differently to get those character names on the map. -- View this message in context: http://r.789695.n4.nabble.com/PCA-factominer-package-question-about-changing-labels-in-individuals-factor-map-tp4683924.html Sent from the R help mailing list archive at Nabble.com.
David Carlson
2014-Jan-21 21:35 UTC
[R] PCA factominer package, question about changing labels in individuals factor map
Try rownames(dat) <- dat[,1] before running PCA. ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Andy.P Sent: Tuesday, January 21, 2014 12:18 PM To: r-help at r-project.org Subject: [R] PCA factominer package, question about changing labels in individuals factor map I am looking to do a PCA with the factominer package on a dataset of mine, named dat. The individuals in my dataset have character names, represented in the first column of my dataset, but since they aren't quantitative I can't include that column in my PCA analysis. Leading to the command > res.pca = PCA(dat[,3:8], scale.unit=TRUE, ncp=5, graph=T) This is all well and good, except when my individuals factor map shows up, each data point is labeled as a number and not as their actual character names. <http://r.789695.n4.nabble.com/file/n4683924/Screen_Shot_2014-01 -21_at_12.19.23_PM.png> How do I go about getting the map to display the character names? If I include the column with the names I get an error because it's not quantitative. I know it can be done because I've seen it on the decathlon dataset, I just don't know what they're doing differently to get those character names on the map. -- View this message in context: http://r.789695.n4.nabble.com/PCA-factominer-package-question-ab out-changing-labels-in-individuals-factor-map-tp4683924.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.