I am trying to drop rows with NAs. The NAs need to be in all the columns I specify. For example, if I specify Tickets, Group then there needs to be NAs in both columns for each row to dictate the row be dropped. I tried doing
df %>% drop_na(Tickets, Group) but got an error saying unexpected , and ). Basically, there are no NAs in City, State, or Date, and I want to remove all the rows with NAs in ALL the other columns.
| City | State | Date | Tickets | Group |
|---|---|---|---|---|
| Chicago | IL | 2021-01-01 | NA | NA |
| Chicago | IL | 2021-02-01 | NA | NA |
| Chicago | IL | 2021-03-01 | 4 | NA |
| Chicago | IL | 2021-03-01 | 3 | 1 |
This is what I want:
| City | State | Date | Tickets | Group |
|---|---|---|---|---|
| Chicago | IL | 2021-03-01 | 4 | NA |
| Chicago | IL | 2021-03-01 | 3 | 1 |
TLDR: I am trying to drop rows which have an NA value in all specified columns.
I'd appreciate help with this.