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]]

______________________________________________
R-help@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.

Reply via email to