有人可以解释为什么以下会产生错误:
library(lubridate)
start_leap = ymd('1992-02-29')
end_leap = ymd('1992-03-01')
interv_leap = start_leap %--% end_leap
interv_leap %/% years(1)
#> Error in while (any(start + est * per < end)) est[start + est * per < :
#> missing value where TRUE/FALSE needed
但这不是:
start = ymd('1993-02-28')
end = ymd('1993-03-01')
interv = start %--% end
interv %/% years(1)
#> 0
我认为这可能与按时段划分有关,但以下所有情况都很好:
interv %/% days(1)
interv %/% months(1)
interv %/% ddays(1)
interv %/% dyears(1)
interv_leap %/% days(1)
interv_leap %/% months(1)
interv_leap %/% ddays(1)
interv_leap %/% dyears(1)
非常感谢参考文献。