powered by
Generic function to calculate the center of a compositional dataset
center(X, zero.rm = FALSE, na.rm = FALSE)
compositional dataset
a logical value indicating whether zero values should be stripped before the computation proceeds.
a logical value indicating whether NA values should be stripped before the computation proceeds.
X = matrix(exp(rnorm(5*100)), nrow=100, ncol=5) g = rep(c('a','b','c','d'), 25) center(X) (by_g <- by(X, g, center)) center(t(simplify2array(by_g)))
Run the code above in your browser using DataLab