[R] PCA and gglot2

John Kane jrkrideau at inbox.com
Thu Jul 11 17:15:40 CEST 2013


Not sure why the problem. I think I'd need see your actual data and give it a try.  If you want to supply your data or a sample of it see ?dput for a convenient way to do so.

I see thought that you've found a dedicated ggplot biplot  so if may not be worth your while.

John Kane
Kingston ON Canada


> -----Original Message-----
> From: ashz at walla.co.il
> Sent: Wed, 10 Jul 2013 12:49:55 -0700 (PDT)
> To: r-help at r-project.org
> Subject: Re: [R] PCA and gglot2
> 
> Dear John,
> 
> Thanks for the help.
> 
> I did some minor modifications to your script as I had some problems:
> ...
> pca = PCA(data[,1:4], scale.unit=T, graph=F)
> dat1  <-  data.frame(pca$scores)  # creates the data.frame
> dat1$items  <-  rownames(data$group) # adds item names
> ggplot(dat1, aes(pca$ind$coord[,1], pca$ind$coord[,2], colour =
> dat1$item))
> + geom_point() + theme(legend.position="none")
> 
> I still do not get separation by color by group (column 5 of csv file) as
> the  dat1 is empty (data frame with 0 columns and 0 rows).
> 
> Any reason why?
> 
> Thanks again.
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/PCA-and-gglot2-tp4671225p4671253.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.

____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails



More information about the R-help mailing list