Many thanks to all who responded, and especially for the promptness of your answers. The common thread in your solutions is the use of rle, a very useful function of which I was ignorant.
--Krishna [[alternative HTML version deleted]] ______________________________________________ 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.