Adding time to POSIXct object in R

前端 未结 3 2053
暖寄归人
暖寄归人 2020-12-08 09:27

I would like to add 1 hour to a POSIXct object, but it does not support \'+\'.

This command:

as.POSIXct(\"2012/06/30\",\"GMT\") 
    + as.POSIXct(pas         


        
3条回答
  •  清歌不尽
    2020-12-08 09:45

    The lubridate package also implements this nicely with convenience functions hours, minutes, etc.

    x = Sys.time()
    library(lubridate)
    x + hours(3) # add 3 hours
    

提交回复
热议问题