R, Statistics, Data Science.
{ apply(x, 2, mean) }, simplify = 'data.frame') n <- dim(root)[1] / length(unique(root$Tree.Number)) total.means <- colMeans(root[,2:5]) The H and E matrices can be computed with the following code. H = matrix(data = 0, nrow = 4, ncol = 4) for (i in 1:dim(H)[1]) { for (j in 1:i) { H[i,j] <- n *