This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/mva/html/prcomp.html
prcomp {mva}R Documentation

Principal Components Analysis

Description

This function performs a principal components analysis on the given data matrix and returns the results as a prcomp object. The print method for the these objects prints the results in a nice format and the plot method produces a scree plot.

Usage

prcomp(x=, scale=FALSE, use="all.obs")

print.prcomp(prcomp.obj)
plot.prcomp(prcomp.obj)

Arguments

x

a matrix (or data frame) which provides the data for the principal components analysis.

scale

a logical value indicating whether the variables should be scaled to have unit variance before the analysis takes place.

use

the strategy to use for dealing with missing observations. The possible values are "all.obs", "complete.obs", or "pairwise.complete.obs". An unambiguous substring can be used.

Value

prcomp returns an list with class "prcomp" containing the following components:

var

the variances of the principal components (i.e. the eigenvalues)

load

the matrix of variable loadings (i.e. a matrix whose columns contain the eigenvectors).

scale

the value of the scale argument.

References

Mardia, K. V., J. T. Kent and J. M. Bibby (1979). Multivariate Analysis, London: Academic Press.

See Also

cor, cov, eigen.

Examples

# the variances of the variables in the
# crimes data vary by orders of magnitude
data(crimes)
prcomp(crimes)
prcomp(crimes,scale=TRUE)