I have a very simple question, but would appreciate advice!
I am trying to run the following dplyr operation to remove rows for 3 states from a dataset containing data by state.
new_data <- old_data %>% filter(state!="NC", state!="AL", state!="AR")
The above command works. But, I am wondering if there is a way to remove the 3 states more simply, without retyping the state!=
bit three times.
For example, maybe I could do something like:
new_data <- old_data %>% filter(state!= ("NC" |"AL" |"AR"))
However, this did not work. Your advice appreciated! Thanks!