Skip to content
Prev 276188 / 398506 Next

how to count number of occurrences

Is the following what you want?  It should give
the number of "X"s immediately preceding each "Y".
"X", "X", "X", "Y", "Y", "Y", "Y", "Y")
[1] 4 0 0 0 5 0 0 0 0

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com