如何用胶水自动化日期字符串

How to automate date sting with glue

我正在尝试使 DateTime 自动化以始终在 t+1 生成报告

我也是

df中的日期格式是这样的 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 

所以每当你看到{昨天}

我想过滤日期时间

我也是

df%>%
    filter(Status == "SUCCESSFUL" & glue:glue(Date >= "{yesterday} 19:15:36" & Date<= 
        "{yesterday} 23:59:59"))

但我在下面收到此错误

Error: Problem with `filter()` input `..1`.
i Input `..1` is `&...`.
x All unnamed arguments must be length 1

我知道问题出在 glue::glue 有人可以帮我重新安排我的代码吗

我找到了问题的解决方案

我意识到我需要在 >= 和 <= 之前粘附到这样的时间

df%>%
filter(Status == "SUCCESSFUL" &
DateTime >= glue("{yesterday} 00:00:00") &
DateTime<= glue("{yesterday} 23:59:59"))

谢谢