Answer: you do not want pc $ rotation, it is a rotation matrix, not a matrix with rotating values ββ(points).
Make some data:
x1 = runif(100) x2 = runif(100) y = rnorm(2+3*x1+4*x2) d = cbind(x1,x2) pc = prcomp(d) dim(pc$rotation) ## [1] 2 2
Unfortunately. The "x" component is what we want. From? Prcomp:
x: if "retx is true", the value of the rotated data is returned (centered (and scaled if necessary) data multiplied by the "rotation" matrix.
dim(pc$x)
source share