Count occurences of substring in string
I’m trying to count the number of times a string, say AAA occurs in a longer string, say AAAA. The answer in this case is clearly 2: AAAA AAAA None of these work as I would expect: stringi::stri_count(str = "AAAA", regex = "AAA") [1] stringr::str_count(string = "AAAA", pattern = "AAA") [1] stringr::str_extract_all("AAAA", "AAA", simplify =… Read More Count occurences of substring in string