I was wondering if there is a package or generic function in R that counts sequence lengths.
For instance, if I input a sequence
s1<-c(‘a’,’a’,’b’,’a’,’a’,’a’,’b’,’b’)
The proposed function F(s1,’a’) would return a vector:
[2,3]
and F(s1,’b’) would return [1,2]
Those madly typing people must have gone elsewhere: