Skip to content
Prev 139350 / 398506 Next

sorting a data.frame by mean values of grouped data

Thanks Mark,

I see that I made an error in my original request for help. I got my 
labels and groups mixed up (see below). Nonetheless, your code has been 
a good pointer in the direction of a solution. I'll post it up when I 
have it working.

Thanks again,
Stephen Barry.

I should have written it more like this:
Given data.frame:
   Value Group Label
     55     D Small
     33     D Small
     11     D Small
     55     D Small
     66     D Small
     11     D Small
     19     A   Big
     29     A   Big
     39     A   Big
     3     B Small
     2     B Small
     5     B Small
     6     B Small
     5     B Small
     6     B Small
     2     C   Big
     3     C   Big
     3     C   Big
     3     C   Big
     3     C   Big
     3     C   Big
     3     C   Big
end up with:
   Value Group Label
    19     A   Big
    29     A   Big
    39     A   Big
     2     C   Big
     3     C   Big
     3     C   Big
     3     C   Big
     3     C   Big
     3     C   Big
     3     C   Big
    55     D Small
    33     D Small
    11     D Small
    55     D Small
    66     D Small
    11     D Small
     3     B Small
     2     B Small
     5     B Small
     6     B Small
     5     B Small
     6     B Small


 >
Mark W Kimpel wrote: