Learn R Programming

Momocs (version 1.1.6)

PCA: Principal component analysis on Coe objects

Description

Performs a PCA on Coe objects, using prcomp.

Usage

PCA(x, scale., center, fac)

# S3 method for OutCoe PCA(x, scale. = FALSE, center = TRUE, fac)

# S3 method for OpnCoe PCA(x, scale. = FALSE, center = TRUE, fac)

# S3 method for LdkCoe PCA(x, scale. = FALSE, center = TRUE, fac)

# S3 method for TraCoe PCA(x, scale. = TRUE, center = TRUE, fac)

# S3 method for default PCA(x, scale. = TRUE, center = TRUE, fac = data.frame())

as.PCA(x, fac)

Arguments

x
a Coe object or an appropriate object (eg prcomp) for as.PCA
scale.
logical whether to scale the input data
center
logical whether to center the input data
fac
any factor or data.frame to be passed to as.PCA and for use with plot.PCA

Value

a 'PCA' object on which to apply plot.PCA

Details

By default, methods on Coe object do not scale the input data but center them. There is also a generic method (eg for traditional morphometrics) that centers and scales data.

See Also

Other multivariate: CLUST, KMEANS, LDA, MANOVA_PW, MANOVA

Examples

Run this code
data(bot)
bot.f <- efourier(bot, 12)
bot.p <- PCA(bot.f)
bot.p
plot(bot.p, morpho=FALSE)
plot(bot.p, 'type')

data(olea)
op <- npoly(olea, 5)
op.p <- PCA(op)
op.p
plot(op.p, 1, morpho=TRUE)

data(wings)
wp <- fgProcrustes(wings, tol=1e-4)
wpp <- PCA(wp)
wpp
plot(wpp, 1)

# "foreign prcomp"
head(iris)
iris.p <- prcomp(iris[, 1:4])
iris.p <- as.PCA(iris.p, iris[, 5])
class(iris.p)
plot(iris.p, 1)

Run the code above in your browser using DataLab