我的样本数据
structure(list(monthly = structure(c(17836, 17866, 17897, 17928,
17956, 17987), class = "Date"), thing = c("fit", "fit",
"fit", "fit", "fit", "fit"), value = c(29.299683040592,
29.4036065235271, 29.5377189221559, 29.6574534926052, 29.7776734210266,
29.9135149187459)), class = c("data.table", "data.frame"), row.names = c(NA,
-6L), .internal.selfref = <pointer: 0x0000000007bc1ef0>)
我正在寻找类似的东西:
monthly thing value
2018-11-30 fit 29.29
2018-12-31 fit 29.40
2019-01-31 fit 29.53
2019-02-28 fit 29.65
2019-03-31 fit 29.77
我尝试过ceiling_date
,但这只是跳到下个月,而不是更改当前月份。感谢您的帮助。