假设我有一个包含 DateTimes 的数组:
> head(DateTime)
[1] "2010-04-23 13:00:00 UTC" "2010-04-23 14:00:00 UTC" "2010-04-23 15:00:00 UTC"
[4] "2010-04-23 16:00:00 UTC" "2010-04-23 17:00:00 UTC" "2010-04-23 18:00:00 UTC"
和另一个每小时值数组:
> head(hour_vals)
[1] 20 20 20 20 20 20
我如何将 DateTime 中的小时数更改为等于 hour_vals 中的小时数,例如:
> head(FinalResult)
[1] "2010-04-23 20:00:00 UTC" "2010-04-23 20:00:00 UTC" "2010-04-23 20:00:00 UTC"
[4] "2010-04-23 20:00:00 UTC" "2010-04-23 20:00:00 UTC" "2010-04-23 20:00:00 UTC"