[R] PCA in R

Liaw, Andy andy_liaw at merck.com
Wed Jul 14 22:19:47 CEST 2004


When all else fails, RTFM; e.g., see ?princomp and read it in its entirety.
Then maybe also try running example(princomp).

Andy

> From: Herman, David (NIH/NIMH)
> 
> Hello,
>             I'm attempting to run a PCA on an example data 
> set. I ran it
> just fine, but I don't know how to few the output?  I listed what the
> variable got stored in it, but I don't know how I can get 
> anything else out
> of it. Are there other ways to view the results?
> Also, I'm confused about the last line "6  variables and  8 
> observations"
> Aren't the rows the variables and the columns the observations?
>  
> (NOTE: if anyone knows a good guide for doing a PCA on an 
> example data set,
> from start to finish, it would be greatly appreciated)
>  
> > m
>      [,1] [,2] [,3] [,4] [,5] [,6]
> [1,]    1    2    3    4    5    6
> [2,]    3    4    3    7    8    1
> [3,]    1    2    3    4    5    6
> [4,]    8    7    4    1    4    3
> [5,]    1    2    3    4    5    6
> [6,]    4    5    8    2    1    3
> [7,]    9    8    7    6    7    8
> [8,]    1    3    7    3    5    0
> > pc.cr<-princomp(m,cor=TRUE)
> > pc.cr
> Call:
> princomp(x = m, cor = TRUE)
>  
> Standard deviations:
>       Comp.1       Comp.2       Comp.3       Comp.4       Comp.5
> Comp.6 
> 1.545609e+00 1.407093e+00 9.886649e-01 7.539927e-01 2.919276e-01
> 2.460515e-09 
>  
>  6  variables and  8 observations.
> >
>  
> thanks! 
> Dave 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>




More information about the R-help mailing list