Skip to content

manipulating PCA output in R

4 messages · Andrew Halford, David Hewitt, Miltinho Astronauta +1 more

#
I'm not sure what you mean by "most important", but I think you want to know
the loadings on the components, which you can retrieve easily from the
object returned by princomp or prcomp (it depends on which function you
used). See ?prcomp and ?princomp. With prcomp the rotations are printed by
default. With princomp, use loadings(princomp.object).

Not sure about suppressing certain arrows (variables) from the plot.

-----
David Hewitt
Research Fishery Biologist
USGS Klamath Falls Field Station (USA)
#
Quoting David Hewitt <dhewitt37 at gmail.com>:
The question was vague, but I assume it concerned prcomp (or princomp)  
and biplot.prcomp (or biplot.princomp). Selecting variables is  
particularly easy in these functions, because they take one-sided  
model formulae. To pick vars x3, x7 and x9 from a data frame df you  
just write prcomp(~ x3 + x7 + x9, data=df). However, there seems not  
be an easy way of omitting variables used in prcomp (or princomp) in  
biplot functions (there may be this option if you use rda function in  
prcomp but not for arrows, only for points or text, but I don't care  
to check the documentation). Since you ask this, I think you'd rather  
want to have factor analysis than PCA. It may be good to consult a  
statistician or a book on this issues.

Best wishes, Jari Oksanen