pcamean: PCA mean

Description Usage Arguments Details See Also Examples

View source: R/mean_pca.R

Description

Takes the average of several PCA objects

Usage

1

Arguments

...

prcomp, princomp or factanal objects, or a single list of such objects

Details

I don't know if this kind of calculation has any sort of merit. It was written more as an impromptu challenge than as a solution to any problem

See Also

prcomp, princomp, factanal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
xx <- data.frame(bee=c(0, 0, 1, 2, 3, 2, 0, 3), 
                wasp=c(1, 3, 2, 0, 1, 1, 2, 1), 
                  fly=c(1, 2, 4, 2, 1, 0, 1, 0),
              beetle=c(1, 0, 0, 1, 2, 2, 0, 2))

set.seed(1)
r <- 1000
xxs <- replicate(r, {
  xx$random <- sample(c(0:1, 0:4), 8, r=TRUE)
  xx
  }, simplify=FALSE)

xxm <- Reduce("+", xxs) / r
xxl <- lapply(xxs, princomp)

biplot(pcamean(xxl))
biplot(princomp(xxm))

AkselA/R-ymse documentation built on March 21, 2020, 9:52 a.m.