[R] how to count number of occurrences

uka s.karmv at gmail.com
Fri Nov 4 00:09:36 CET 2011


This was very helpful. Thank you very much. Just one question, I notice that
it does not count the number of X's before the first Y. I want the result be
1 4 0 0 0 5 0 0 0 0. I tried combining this output with the first value of
rle output, but realized that rle doesn't give me the 0s. So, if my first
observation was Y, then I want it to show that there are 0 Xs before that.
Thank you again.

--
View this message in context: http://r.789695.n4.nabble.com/how-to-count-number-of-occurrences-tp3979546p3988529.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list