[R] creating table of averages

2008-09-09 Thread Lawrence Hanser
Dear Colleagues, I have a dataframe with variables: [1] ID category a11a12 a13a21 [7] a22a23a31a32 b11b12 [13] b13b21b31b32 b33b41 [19] b42

Re: [R] creating table of averages

2008-09-09 Thread Adam D. I. Kramer
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

Re: [R] creating table of averages

2008-09-09 Thread Duncan Murdoch
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

Re: [R] creating table of averages

2008-09-09 Thread Lawrence Hanser
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