> -----Original Message-----
> Okay, try this:
> 
>   result <- with(data,
>                  aggregate(data[,-(1:2)], by=list(ID), FUN=diff))
> 
> This assumes that the dataframe is sorted as in your example. 
> If that's not the case, then use order to arrange it first:


A caveat: order and sort will return order of factor levels for factors and 
that is not necessarily alphanumeric order. The default order here is (T1, T2) 
but that need not be the case if the levels were allocated explicitly. So make 
sure that the factor _levels_ are in the order you expect!

Steve E*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to