[R] Runs Statistic

Janusz Kawczak jkawczak at uncc.edu
Tue Sep 4 07:40:27 CEST 2001

Dear R users:

I am trying to get the runs statistics for a very long binary sequences
and I ran into trouble with the sped  when using (probably too many) "if"
and "for" statements in my program. Let me explain what I would like to
see as the final output. Say, I have a sequence 1001101000. The runs vector
should be r=(1,2,2,1,1,3), i.e. counting similar subsequences. Also, it
could be treated as an independent question, the longest run is of

Just to give you an idea the length of the original sequences will be of
order 10^6 and greater.

Any help greatly appreciated.

** Janusz Kawczak							**
** UNC at Charlotte, Department of Mathematics, Room 350F		**
** 9201 University City Blvd.						**
** Charlotte, NC, 28223-0001, U.S.A.					**
** Tel.: (704) 687-2566 (W) (704) 921-0273 (H) Fax.: (704) 687-6415	**

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list