我使用lubridate并认为这会很容易
ymd("2010-01-31")+months(0:23)
但是,看看有什么。都搞砸了!
[1] "2010-01-31 UTC" "2010-03-03 UTC" "2010-03-31 UTC" "2010-05-01 UTC" "2010-05-31 UTC" "2010-07-01 UTC" "2010-07-31 UTC" "2010-08-31 UTC" "2010-10-01 UTC"
[10] "2010-10-31 UTC" "2010-12-01 UTC" "2010-12-31 UTC" "2011-01-31 UTC" "2011-03-03 UTC" "2011-03-31 UTC" "2011-05-01 UTC" "2011-05-31 UTC" "2011-07-01 UTC"
[19] "2011-07-31 UTC" "2011-08-31 UTC" "2011-10-01 UTC" "2011-10-31 UTC" "2011-12-01 UTC" "2011-12-31 UTC"
然后,我阅读了润滑如何满足间隔,持续时间和周期等现象。所以,好的,我意识到一个月实际上是(365 * 4 + 1)/ 48 = 30.438天定义的天数。所以我试图变得聪明,并将其重写为
ymd("2010-01-31")+ as.period(months(0:23))
但这只是一个错误。
Error in as.period.default(months(0:23)) :
(list) object cannot be coerced to type 'double'
明月笑刀无情