I prefer the idiom c(TRUE, a[-1] != a[-length(x)]) because it works for character and other data types as well.
I also find that thinking in terms of runs instead of subscripting tricks is easier. ______________________________________________ [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.

