Dear Colleagues,
I have a dataframe with variables:
[1] ID category a11a12
a13a21
[7] a22a23a31a32
b11b12
[13] b13b21b31b32
b33b41
[19] b42
Maybe something like this:
by(df[,c(77,81,86,90,94,98,101,106)],df$category,apply,2,mean)
...which would then need to be reformatted into a data frame (there is
probably an easy way to do this which I don't know).
aggregate seems like a more reasonable choice, but the function for
aggregate
On 9/9/2008 2:12 PM, Adam D. I. Kramer wrote:
Maybe something like this:
by(df[,c(77,81,86,90,94,98,101,106)],df$category,apply,2,mean)
...which would then need to be reformatted into a data frame (there is
probably an easy way to do this which I don't know).
sparseby() in the reshape
Perfect!
Thanks.
On Tue, Sep 9, 2008 at 11:27 AM, Duncan Murdoch [EMAIL PROTECTED]wrote:
On 9/9/2008 2:12 PM, Adam D. I. Kramer wrote:
Maybe something like this:
by(df[,c(77,81,86,90,94,98,101,106)],df$category,apply,2,mean)
...which would then need to be reformatted into a data frame
4 matches
Mail list logo