Suppose we need to do the sum of each column in a dataset
set.seed(20)
df1 <- data.frame(ID = rep(c("A", "B", "C"), each = 3), V1 = rnorm(9), V2 = rnorm(9))
m1 <- as.matrix(df1[-1])
There are many ways to do this. Using base R, the best option would be col...