aggmean | R Documentation |
Calculation of the centers (means) of classes of row observations of a data set.
aggmean(X, y = NULL)
X |
Data ( |
y |
Class membership ( |
A list of outputs.
n <- 8 ; p <- 6
X <- matrix(rnorm(n * p, mean = 10), ncol = p, byrow = TRUE)
y <- sample(1:2, size = n, replace = TRUE)
aggmean(X, y)
data(forages)
Xtrain <- forages$Xtrain
ytrain <- forages$ytrain
table(ytrain)
u <- aggmean(Xtrain, ytrain)$ct
headm(u)
plotsp(u, col = 1:4, main = "Means")
x <- Xtrain[1:20, ]
plotsp(x, ylab = "Absorbance", col = "grey")
u <- aggmean(x)$ct
plotsp(u, col = "red", add = TRUE, lwd = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.