ymd
is a wrapper to parse date strings and returns a POSIXct
object.
You simply need to use standard terminology described in ?seq.POSIXt
(not lubridate
) to define weeks
seq(ymd('2012-04-07'),ymd('2013-03-22'), by = '1 week')
seq(ymd('2012-04-07'),ymd('2013-03-22'), by = 'weeks')
will works
as will
seq(ymd('2012-04-07'),ymd('2013-03-22'), by = '2 week')
You could coerce the lubridate
Period
class object to a difftime
, but that seems rather unnecessary
seq(ymd('2012-04-07'),ymd('2013-03-22'), by = as.difftime(weeks(1)))