I have a list of {0,1} values, say
y-c(0,0,0,1,1,0,0,1,0,1,1,1,1)
I want to compute the first few zeros and the last few ones. So the output I
expect is 3 and 4 for this vector. Is there a fast way to match the numbers
easily?
[[alternative HTML version deleted]]
Try this:
rle(y)$len[c(1, length(rle(y)$len))]
On Fri, Oct 24, 2008 at 10:34 AM, gallon li [EMAIL PROTECTED] wrote:
I have a list of {0,1} values, say
y-c(0,0,0,1,1,0,0,1,0,1,1,1,1)
I want to compute the first few zeros and the last few ones. So the output
I
expect is 3 and 4 for this
2 matches
Mail list logo