On Oct 12, 2012, at 1:07 AM, Henri-Paul Indiogine wrote: > Hi Michael! > > 2012/10/12 R. Michael Weylandt <[email protected]>: >> If they are already in decreasing order, you might be able to work >> something out like (untested): >> >> cumsum(c(1, diff(x) < 0)) > > Thanks seems to work. Thanks a bunch!
Another strategy: cumsum(!duplicated(x)) -- David Winsemius, MD Alameda, CA, USA ______________________________________________ [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.

