powered by
meanMat(A, usedim = 2)
A <- matrix(rnorm(1e6),1000,1000) b <- meanMat(A) # same as apply(A,2,mean) b1 <- meanMat(A,1) # same as apply(A,1,mean) #compare timing system.time(meanMat(A)) system.time(apply(A,2,mean))
Run the code above in your browser using DataLab