Hello, I am working with very large matrices 10000 by 2000 and for each row I have a grouping vector and I would like to average each row by groups... Presently I am using this command and it behaves correctly even with NA values is the groupvector: data<-aggregate(mymatrix,list(groupvector),mean) Is there a faster method Thanks! S??bastien -- S??bastien Durand Ma??trise en biologie Universit?? de Montr??al (514) 343-6864 Universit?? du Qu??bec ?? Montr??al (514) 987-3000 (1572#)