A<- c('C-C-C','C-C', 'C-C-C-C')
library(stringr)
B<- str_count(A, "C-C")
df<- data.frame(A,B)
A B (expected) B(actual)
C-C-C 2 1
C-C 1 1
C-C-C-C 3 2
I am trying to count all the transitions, however, I am getting the wrong answer. Can someone suggest how to fix this?