Filtering multiple domains in R and using not operator

I can't be sure because you haven't provided a reproducible example (I don't know from where the Hotel Bookings data frame comes from), but I think this is what you want to do.

bookings %>% 
    filter((arrival_date_year == 2015 | arrival_date_year == 2016),
           arrival_date_month == "June",
           reservation_status != "Canceled")

If this doesn't solve your problem, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

1 Like