[R] Finding sets

From: Muhammad Rahiz <muhammad.rahiz_at_ouce.ox.ac.uk>
Date: Fri, 25 Jun 2010 10:30:37 +0100


Hi all,

I'd like to find how many sets of 1s there are in the following example;

x <- rep(c(1,2,1,3,5), each=5)

I know that there are two sets of 1s, visually. Any function in R that allows me to automate the process?

Thanks.

Muhammad



R-help_at_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. Received on Fri 25 Jun 2010 - 09:33:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Jun 2010 - 10:00:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive