Just wondering whether it is possible to calculate means for multiple columns by just using the mean function
e.g.
mean(iris[,1])
i
Your above solution does work assuming the columns are in the correct is.numeric format. See below example:
a <- c(1,2,3) mean(a) b <- c(2,4,6) mean(b) d <- c(3,6,9) mydata <- cbind(b,a,d) mean(mydata[,1:3])