Hi, Sorry for replying to myself, but I think I have found a solution for my first question.
> First, I would like to create a "counter" variable which will count > the rank of each row inside each "id" level, ie something like : > > id type counter > 10002 "7" 1 > 10061 "1" 1 > 10061 "1" 2 > 10061 "4" 3 > 10065 "7" 1 > 10114 "1" 1 > 10114 "1" 2 > 10114 "4" 3 > 10136 "7" 1 > 10136 "2" 2 > 10136 "2" 3 If I use : df$counter <- unlist(tapply(df$id, df$id, order)) But there may be a better solution... -- Julien ______________________________________________ [EMAIL PROTECTED] 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.
