[R] plotting prcomp

From: Dan Bolser <dan.bolser.r_at_googlemail.com>
Date: Fri, 27 Jun 2008 17:35:36 +0200

Please consider the following PCA example;

my.df <-
  data.frame(A=(x <- rnorm(100,mean=100, sd=10)),

             B=(y <- x + rnorm(100,mean=10, sd=10)))


my.pc <-
  prcomp(my.df, center=TRUE, scale=TRUE)


my.x <- (my.pc$x)[,1]
my.y <- (my.pc$x)[,2]

plot(my.x, my.y, type="n")
text(my.x, my.y, labels=1:100)

Clearly the plots have the same relative values, but I can't work out how the second plot is relative to the first. I have been reading the manual, but I still can't work it out.

Can anyone show me the code to generate the data that I see plotted using biplot? What am I missing?


        [[alternative HTML version deleted]]

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. Received on Fri 27 Jun 2008 - 15:50:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 27 Jun 2008 - 16:30:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive