Dear R wizards: First, thanks for the notes on SQL. These pointers will make it a lot easier to deal with large data sets. Sorry to have a second short query the same day. I have been staring at this for a while, but I cannot figure out how to do a dependent ranking the R-sh way.
ds= data.frame( xn=rnorm(32), yn=rnorm(32), zn=rnorm(32) ) ds$drank1group= as.integer((rank( ds$xn )-1)/4) # ok, the first set of 8 groups, each with 4 elements ds$drank2.bydrank1group= ??? ## here I want within each drank1group the rank based on yn (from 1 to 4) something like "by(ds,drank1group, rank(ds$yn))". obviously, this neither works nor has same dimensional output. of course, there is a really simple, clever way to do this in R...except that it totally eludes me. before I start writing a hand iterating function, could someone please let me know how to do this? regards, /iaw ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.