[R] Ranking factors given a weight

From: Albert Vilella <avilella_at_gmail.com>
Date: Tue 20 Dec 2005 - 19:14:25 EST

Hi all,

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 of both.

There must be a way to do that with ave() or sort() but I haven't found how.

Thanks in advance,


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Dec 20 19:20:44 2005

This archive was generated by hypermail 2.1.8 : Tue 20 Dec 2005 - 20:34:23 EST