简体   繁体   English

计算R中特定日期和今天日期之间的天数

[英]Calculate number days between specific date and today's date in R

在此处输入图片说明

Hello, 你好,

i am trying to calculate the number of days since the complaint was registered. 我正在尝试计算自投诉被注册以来的天数。 I wanted to calculate the number of days between "Date Notified" and today's date. 我想计算“已通知日期”和今天之间的天数。 i used the below command to get the result but it is showing me an error. 我使用下面的命令来获取结果,但它显示了一个错误。 Can anyone please help me ! 谁能帮帮我吗 !

Mergingopen%>%
  mutate(30 days since file opened = `Date Notified`,Sys.Date())

Try 尝试

Mergingopen %>%
        mutate('30 days since file opened' = as.numeric(difftime(Sys.Date(),
                                                                 `Date Notified`,
                                                                 units = c("days"))))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM