Search code examples
rfilterout

Filtering out by multiple criteria in R


I'm trying to create a separate df in R by filtering out observations based on specific criteria, but when using filter function from diplyr I only manage to create a df based on that criteria.

Can any body guide me on the right direction

test <- df_settlement %>% filter( Country Code== 'BE' &Order Date >= '2022-03-18' )


Solution

  • You have it almost right, you just want a comma after 'BE' instead of an &. It should look like this:

    test <- df_settlement %>%
         filter(Country Code== 'BE',
                Order Date >= '2022-03-18')