Skip to content
Prev 64970 / 398498 Next

How to set up number of prin comp.

On Fri, 2005-02-25 at 20:29 +0800, WeiQiang.Li at seagate.com wrote:
Three most useful commands are help(), str() and names().

The first tells you how to use prcomp() and how it names its results.
Try help(prcomp).
The second peeks into the result so you see what is in there. Try (with
your result) srt(pc).
The third tells you what names are available in your result.
The first (help) is the most useful of these commands, since it tells
you what these names and items are. If you read it, you should say:
pc$x[, 1:4] # The four first score vectors
pc$rotation[, 1:4] # The four first loadings

Also, loadings(pc) should work with prcomp.

I think I'll write functions as.prcomp.princomp and as.princomp.prcomp
someday. 

cheers, jari oksanen