[R] Ranking factors given a weight
avilella at gmail.com
Tue Dec 20 09:14:25 CET 2005
I'm trying to rank a couple of factors by a variable and a weight of
the variable in each occurrence (some samples are bigger than others).
input = data.frame(
alfa = rnorm(5000),
weight = rnorm(5000,-50000,100000),
tag1 = sample(c("a","b","c","d"),5000,replace=TRUE),
tag2 = sample(c("i","j","k"),5000,replace=TRUE)
alfa are the observations, each of which has a weight, and tag1 and
tag2 are the factors.
The idea would be to have a ranking of tag1, tag2, and a combination
There must be a way to do that with ave() or sort() but I haven't
Thanks in advance,
More information about the R-help