This is very simple R question but I could not find an answer.
I would like to find strings starting with a specific pattern.
e.g. if I have the pattern
\"ABC
You could use substr
for this:
test <- c("ABCGDFGFD","WWABC","AYBC")
substr(test, 1, 3) == 'ABC'
[1] TRUE FALSE FALSE
If it needs to be longer or shorter, you can change the arguments in substring from 1 and 3. With 1 and 3, it starts at the beginning of each string, and looks up to, and including, the third character.