I'm trying to automate DateTime to always generate a report on t+1
so I did
the date format in the df is like this 2021-12-21 23:59:52 2021-12-21 21:37:50 2021-12-21 19:41:18 2021-12-21 19:21:36 2021-12-21 19:15:41 2021-12-21 19:15:36
yesterday<- Sys.Date()-1 #this will always do yesterday date
so whenever you see {yesterday}
I want to filter the DateTime
so I did
df%>%
filter(Status == "SUCCESSFUL" & glue:glue(Date >= "{yesterday} 19:15:36" & Date<=
"{yesterday} 23:59:59"))
but I'm getting this error below
Error: Problem with `filter()` input `..1`.
i Input `..1` is `&...`.
x All unnamed arguments must be length 1
I know the problem is the glue::glue can someone help me rearrange my code pls
I was able to come across a solution for the question
I realize that I needed to glue both before >= and <= to the time which goes like this
df%>%
filter(Status == "SUCCESSFUL" &
DateTime >= glue("{yesterday} 00:00:00") &
DateTime<= glue("{yesterday} 23:59:59"))
Thanks