Try this:
df$group <- factor(df$group)
levels(df$group)<- names(sort(tapply(df$weight, df$group, sum),
decreasing=T))
On 28/11/2007, Serguei Kaniovski <[EMAIL PROTECTED]> wrote:
>
>
> Dear All,
>
> Suppose I have the following dataframe:
>
> country;weight;group
> bul;10;1
> cze;12;1
> grc;12;1
Dear All,
Suppose I have the following dataframe:
country;weight;group
bul;10;1
cze;12;1
grc;12;1
hun;12;1
prt;12;1
rom14;1
fra;29;2
ita;29;2
gbr;29;2
aut;10;3
bel;12;3
The "group" variable denotes the id-number of a group of countries. How can
I re-label the groups in the descending order of t
2 matches
Mail list logo