Learn R Programming

zoocat (version 0.2.0.1)

prcomp.zoocat: Principal components analysis of a zoocat object

Description

Principal components analysis of a "zoocat" object. This function is a wrap of the stats::prcomp. The rotation returned by stats::prcomp is binded with the cattr table to be a data frame, and the x returned by stats::prcomp is binded with the index to be a "zoo" object.

Usage

# S3 method for zoocat
prcomp(x, ...)

Arguments

x

the zoocat object.

...

other argument.

Value

a list with following elements: prcomp.obj (the object returned by stats::prcomp), rotation (the data frame containing information of the variable loadings), z (the zoo object containing the rotated data).

Examples

Run this code
# NOT RUN {
x <- matrix(1 : 20, nrow = 5)
colAttr <- data.frame(month = c(2, 3, 5, 6), name = c(rep('xxx', 3), 'yyy'))
zc <- zoocat(x, order.by = 1991 : 1995, colattr = colAttr)
pca <- prcomp(zc)
print(pca$rotation)
print(pca$z)

# }

Run the code above in your browser using DataLab