I want to find elements that contain the star symbol in the next vector.
s <- c("A","B","C*","D","E*") grep("*",s) [1] 1 2 3 4 5
This does not work. I can understand this because it is a special character.
When I read here , I decided to use the "\" before the star. But this gave me an error:
grep("\*",s) Error: '\*' is an unrecognized escape in character string starting ""\*"
What am I doing wrong?
source share