无法使用 lubridate 计算简单的日期差异
cannot compute a simple date difference with lubridate
使用 lubridate
我想提取两个日期之间的天数差异,作为纯整数。但是,我似乎无法做到这一点:
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#>
#> date
current <- Sys.Date()
future <- ymd('2020-03-13')
mday(future - current)
#> Error in as.POSIXlt.default(x, tz = tz(x)): do not know how to convert 'x' to class "POSIXlt"
我该如何解决这个错误?
mday(未来 - 当前)解释为什么这不起作用。
mday 找出一个月中的第几天,这只需要一个参数。
mday(future)
使用 lubridate
我想提取两个日期之间的天数差异,作为纯整数。但是,我似乎无法做到这一点:
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#>
#> date
current <- Sys.Date()
future <- ymd('2020-03-13')
mday(future - current)
#> Error in as.POSIXlt.default(x, tz = tz(x)): do not know how to convert 'x' to class "POSIXlt"
我该如何解决这个错误?
mday(未来 - 当前)解释为什么这不起作用。
mday 找出一个月中的第几天,这只需要一个参数。
mday(future)