[R] seq() problem with chron

Waichler, Scott R Scott@W@ichler @ending from pnnl@gov
Thu Sep 6 07:00:52 CEST 2018


Hi, 

I encountered the problem below where the last value in the chron vector created with seq() should have a time of 15:30, but instead has 15:15.  What causes this and how can I make sure that the last value in the chron vector is the same as the "to" value in seq()?

library(chron)
dt1 <- chron("02/20/13", "00:00:00")
dt2 <- chron("07/03/18", "15:30:00")
dt <- seq(from=dt1, to=dt2, by=1/(24*4))
dt[length(dt)]
#[1] (07/03/18 15:15:00)

Thanks,
Scott Waichler
Pacific Northwest National Laboratory
scott.waichler using pnnl.gov



More information about the R-help mailing list