On Feb 15, 2011, at 12:18 PM, mathijsdevaan wrote:
Thanks for your quick response. The solution that you propose comes
close to
what I want, however by using 'FUN = order', the new variable is
based on
its order rather than y< focal y. In the case of two similar rows
(Xrow1=Xrow2 and Yrow1=Yrow2), the value of Zrow1 < Zrow2. Any
solutions?
First a suggestion. Please include context when following up on r-
help. Nabble provides a simple method for doing so.
Here is a method that works despite generating a warning:
cbind(X, z = ave(X$y, X$x, FUN = seq) - 1)
--
View this message in context:
http://r.789695.n4.nabble.com/Count-factor-if-tp3306856p3307164.html
Sent from the R help mailing list archive at Nabble.com.
David Winsemius, MD
West Hartford, CT
______________________________________________
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.