Problems when filtering a row in a table

Solution 1:

Here's a possible approach, writing out what's already been outlined in the comments. I used ymd from lubridate to convert the date string to a date object.

library(dplyr)
library(lubridate)

idd<-4
dmda<-ymd("2022-01-12")
CategoryChosse<-"ABC"

df1 %>% 
  filter(Id == idd, date2 == dmda, Category == CategoryChosse)
# A tibble: 1 x 11
     Id date1               date2               Week  Category   DR1  DRM0 DRM01
  <dbl> <dttm>              <dttm>              <chr> <chr>    <dbl> <dbl> <dbl>
1     4 2022-01-12 00:00:00 2022-01-12 00:00:00 Wedn… ABC          0     0     0
# … with 3 more variables: DRM02 <dbl>, DRM03 <dbl>, DRM04 <dbl>