Josh B wrote:
Hello again,

I was hoping one of you could help me with this problem. Consider the
sample data from R:

summary(prcomp(USArrests))
Importance of components: PC1     PC2    PC3     PC4 Standard
deviation     83.732 14.2124 6.4894 2.48279 Proportion of Variance
0.966  0.0278 0.0058 0.00085 Cumulative Proportion   0.966  0.9933
0.9991 1.00000

How do I access the information contained within this summary? For
instance, let's say I wanted to make a graph based on the second row
("Proportion of Variance").


The easiest way is to use the ?str function to see how an object is put together.

So, assign the results of the summary to a variable

x <- summary(prcomp(USArrests))

then

str(x)

will lead you to :

plot(x$importance[2, ], type = "l")

______________________________________________
R-help@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.

Reply via email to