Re: [R] Determine longest run of number

2012-11-02 Thread Mark Del Cerro
Hi Michael, Thanks for the response -- that's exactly what I was looking for. Thanks, Mark -Original Message- From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] Sent: Friday, November 02, 2012 3:02 PM To: Mark Del Cerro Cc: r-help@r-project.org Subject: Re: [R] Dete

[R] Determine longest run of number

2012-11-02 Thread Mark Del Cerro
Does anybody know a way to determine the longest run of a number in a vector of numbers? For example if I have the following numbers: 0 0 1 1 1 1 0 1 1 0 0 0 1 1; how can I determine that the longest run of 1's = 4 and longest run of 0's = 3? Thanks, Mark _