0

I know this is a very basic question, but I can't seem to find the answer anywhere.

If I have a vector of strings like this:

a <- c("a", "b", "bb", "c", "d", "dd", "e")

And I want to check which elements are equal to either "b" OR "d" exactly, so not using grep, what should I do?

I was expecting something like:

a == "b" || "d"

to get this result:

[1] FALSE TRUE FALSE FALSE TRUE FALSE FALSE 

Obviously that command does not work, and I am not sure how to use "or" in this case.

Thank you!

arielle
  • 915
  • 1
  • 12
  • 29

0 Answers0