Re: [R] algorithm help

2011-01-07 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/06/2011 11:57 PM, (Ted Harding) wrote: On 06-Jan-11 22:16:38, array chip wrote: Hi, I am seeking help on designing an algorithm to identify the locations of stretches of 1s in a vector of 0s and 1s. Below is an simple example:

[R] algorithm help

2011-01-06 Thread array chip
Hi, I am seeking help on designing an algorithm to identify the locations of stretches of 1s in a vector of 0s and 1s. Below is an simple example: dat-as.data.frame(cbind(a=c(F,F,T,T,T,T,F,F,T,T,F,T,T,T,T,F,F,F,F,T) ,b=c(4,12,13,16,18,20,28,30,34,46,47,49,61,73,77,84,87,90,95,97))) dat a

Re: [R] algorithm help

2011-01-06 Thread Carl Witthoft
try this: ?rle Carl ** From: array chip arrayprofile_at_yahoo.com Date: Thu, 06 Jan 2011 14:16:38 -0800 (PST) Hi, I am seeking help on designing an algorithm to identify the locations of stretches of 1s in a vector of 0s and 1s. Below is an simple example:

Re: [R] algorithm help

2011-01-06 Thread Ted Harding
On 06-Jan-11 22:16:38, array chip wrote: Hi, I am seeking help on designing an algorithm to identify the locations of stretches of 1s in a vector of 0s and 1s. Below is an simple example: dat-as.data.frame(cbind(a=c(F,F,T,T,T,T,F,F,T,T,F,T,T,T,T,F,F,F,F,T)

Re: [R] algorithm help

2011-01-06 Thread array chip
From: ted.hard...@wlandres.net ted.hard...@wlandres.net Cc: r-h...@stat.math.ethz.ch Sent: Thu, January 6, 2011 2:57:47 PM Subject: RE: [R] algorithm help On 06-Jan-11 22:16:38, array chip wrote: Hi, I am seeking help on designing an algorithm to identify the locations of stretches of 1s

Re: [R] algorithm help

2011-01-06 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of array chip Sent: Thursday, January 06, 2011 3:29 PM To: ted.hard...@wlandres.net Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] algorithm help Thanks very much, Ted. Yes

Re: [R] algorithm help

2011-01-06 Thread array chip
Thanks very much Bill, good catch! John From: William Dunlap wdun...@tibco.com Cc: r-h...@stat.math.ethz.ch Sent: Thu, January 6, 2011 3:52:47 PM Subject: RE: [R] algorithm help -Original Message- From: r-help-boun...@r-project.org [mailto:r-help