[R] Accessing the elements of summary(prcomp(USArrests))
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Jun 16 23:15:49 CEST 2010
Hints:
(i) List the function by stats:::summary.prcomp . You will see that
the table is component 'importance' of the list result. So take a look
at summary(prcomp(USArrests))$importance[2, ]
(ii) This looks a lot like screeplot().
(iii) prcomp(USArrests) is inappropriate, as the help file for
prcomp stresses.
On Wed, 16 Jun 2010, 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").
>
> Please rest assured this is not a homework assignment. I'm just a relatively novice R user trying to do stuff that's often over my head.
>
> Thanks in advance,
> -----------------------------------
> Josh Banta, Ph.D
> Center for Genomics and Systems Biology
> New York University
> 100 Washington Square East
> New York, NY 10003
> Tel: (212) 998-8465
> http://plantevolutionaryecology.org
>
>
>
> [[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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list