I am trying to do an ifelse statement that tests if a variable is equal to a series of character strings. In dummy data, I am trying the following:
mtcars$mpg <- as.character(mtcars$mpg)
table(ifelse(mtcars$mpg == c("21", "18.1", "14.3"), "TRUE", "FALSE"))
I want this to produce 4 Trues, and 28 Falses.