Skip to content
Prev 65422 / 398506 Next

Basic stratification calculations

On Mar 4, 2005, at 6:55 AM, Clint Harshaw wrote:

            
You can automate this using aggregate:

 > a <- rep(c('A','B','C','D'),25)
 > b <- rnorm(100)
 > aggregate(b,by=list(a),mean)
   Group.1          x
1       A  0.1409995
2       B -0.1524387
3       C  0.3329184
4       D  0.1354157

Sean