[R] PCA and gglot2

John Kane jrkrideau at inbox.com
Wed Jul 10 21:13:13 CEST 2013


'Sorry I made a mistake .  I was using some data of my own and didn't make some key changes to the script to match your variables.


dat1  <-  data.frame(pca1 $scores)  # creates the data.frame
dat1$items  <-  rownames(data1pca1 ) # adds item names
ggplot(dat1, aes(Comp.1, Comp.2, colour = items)) + geom_point() +
   theme(legend.position="none")

A quick look suggests that this is roughly the same plot as in the example Fig 4 but there the author is using geom_segment to add the lines but I have not looked at it all that carefully.





John Kane
Kingston ON Canada


> -----Original Message-----
> From: ashz at walla.co.il
> Sent: Wed, 10 Jul 2013 11:02:11 -0700 (PDT)
> To: r-help at r-project.org
> Subject: Re: [R] PCA and gglot2
> 
> Hi,
> 
> Thanks. Fig 4 in the link you provided is what I am looking for.
> 
> I still do not know how to implement my data1 and pca1 in the script you
> provided as I think it is only a part of a full script.
> "
> data1<-read.csv("C:/…/MyPCA.csv")
> pca1 <- princomp(data1[,1:4], score=TRUE, cor=TRUE)
> "
> 
> Am I right, how can I implement my data.frames?
> 
> Thanks again
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/PCA-and-gglot2-tp4671225p4671237.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.

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!



More information about the R-help mailing list