GaB
GaB

Reputation: 1132

generating dates and times for three months with lubridate

I am looking to generate a 3 months date and time column with lubridate.

I have followed the suggestions already in stack overflow but mostly these are for dates only. Yet I want to generate a sequence for 3 months with time, alongside with 24hr.

A sample of the type of columns I want is here but this is only for a month yet I need it for 3 months:

> dput(interv)
  structure(c(1326585600, 1326589200, 1326592800, 1326596400, 1326600000, 
              1326603600, 1326607200, 1326610800, 1326614400, 1326618000, 
              1326621600, 1326625200, 1326628800, 1326632400, 1326636000, 
              1326639600, 1326643200, 1326646800, 1326650400, 1326654000, 
              1326657600, 1326661200, 1326664800, 1326668400, 1326672000), 
              class = c("POSIXct", "POSIXt"), tzone = "")

Upvotes: 1

Views: 63

Answers (1)

Patrik_P
Patrik_P

Reputation: 3200

Try sequence of POSIXt classes:

seq.POSIXt(from = as.POSIXct("2012-01-15 01:00:00 CET"), 
           to = as.POSIXct("2012-03-16 01:00:00 CET"), 
           by = "hour")

Upvotes: 2

Related Questions