Skip to content
Prev 201610 / 398506 Next

difference of two rows

You want to use tapply

?tapply

This is a simple example

dat = data.frame(a=sample(1:10,100,T),b=rnorm(100,0,1))
tapply(dat$b,dat$a,mean)

Hope that helps,
Sam
On Wed, Nov 25, 2009 at 11:55 AM, clion <birte_2 at hotmail.com> wrote: