Edit: from the comments and with a little testing, one could find that my suggestion was incorrect.
Here are two correct solutions:
vector[!grepl("['pyfgcrl]", vector)] ## kohske grep("['pyfgcrl]", vector, value = TRUE, invert = TRUE) ## flodel
If one of them wants to resend the message and accept credit for his reply, I am more than happy to delete it here.
Explanation
The general function you are looking for is grepl . From the help file for grepl :
grepl returns a boolean vector (matches or not for each x element).
In addition, you should read the regex help page that describes character classes. In this case, you create a character class ['pyfgcrl] that says to search for any character in square brackets. Then you can undo it with ! .
So, up to this point, we have something similar:
!grepl("['pyfgcrl]", vector)
To get what you are looking for, you multiply, as usual.
vector[!grepl("['pyfgcrl]", vector)]
For the second solution suggested by @flodel, grep by default returns the position at which the match is performed, and the argument value = TRUE allows you to return the actual string value instead. invert = TRUE means returning values โโthat were not matched.