I like to know the number 0that is surrounded 1. But if there is more than one 0without interruption 1, it is considered only one.
string <- "1101000010101111001110"
This is the closest I can do:
length(gregexpr(pattern ="101",string)[[1]])
Expected Result:
5
source
share