Re: [R] Aggregate with functions using multiple arguments

2008-03-22 Thread jim holtman
Is this what you want? > DAT siteobsfrc 1A 1.2745106 -1.6899502 2B 1.4394225 0.4167296 3A -0.1087532 0.7710872 4B -0.6319814 -0.2177236 5A -0.4208416 0.5099765 > (z <- by(DAT, list(DAT$site), function(x) mean(x$obs - x$frc))) : A [1] 0.3846007 ---

[R] Aggregate with functions using multiple arguments

2008-03-21 Thread Matt Pocernich
Hello, I would like to use aggregate with a function that requires several argument that are columns of data. As a simple example, suppose I have data in the following dataframe and I would like to summarize the difference between columns obs and frc for each site. How would I do this? (