groups <- levels(as.factor(factors))
means <- array(NA, c(length(groups), dim(data)))
for(i in 1:length(groups))
means[i,] <- apply(data[factors == groups[i], , drop = FALSE], 2, mean)
colnames(means) <- colnames(data)
Any scripts or data that you put into this service are public.
Add the following code to your website.
Copy to clipboard
For more information on customizing the embed code, read Embedding Snippets.