Equivalent to rowMeans() for min()

Viewed 14975

I have seen this question being asked multiple times on the R mailing list, but still could not find a satisfactory answer.

Suppose I a matrix m

m <- matrix(rnorm(10000000), ncol=10) 

I can get the mean of each row by:

system.time(rowMeans(m))  
   user  system elapsed   
  0.100   0.000   0.097

But obtaining the minimum value of each row by

system.time(apply(m,1,min))  
   user  system elapsed   
 16.157   0.400  17.029

takes more than 100 times as long, is there a way to speed this up?

6 Answers
Related