creates date sequence given start and stop dates

date_seq(
  start,
  end,
  step = c("day", "week", "month", "quarter", "year", "minute"),
  rm.leap = FALSE
)

Arguments

start

Start date in "yyyy/mm/dd" character format

end

End date in "yyyy/mm/dd" character format

step

Time step, options are c("day", "week", "month", "quarter", "year", "minute")

rm.leap

Remove extra days in leap years

Value

A date vector of class POSIXct for minute and Date for other options

Author

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

# monthly steps 1990/01/01 - 2019/12/31 d <- date_seq("1990/01/01", "2019/12/31", step="month")
#> The following are leap years 1992 1996 2000 2004 2008 2012 2016
# daily steps 1990/01/01 - 2019/12/31 d <- date_seq("1990/01/01", "2019/12/31", step="day")
#> The following are leap years 1992 1996 2000 2004 2008 2012 2016
# daily steps 1990/01/01 - 2019/12/31 with leap days removed d <- date_seq("1990/01/01", "2019/12/31", step="day", rm.leap=TRUE)
#> The following are leap years 1992 1996 2000 2004 2008 2012 2016
# daily step 2008/12/29 - 2008/12/31, 2008 is leap year d <- date_seq("2008/12/29", "2008/12/31")
#> The following are leap years 2008
# minutes step 2008/12/29 - 2008/12/31, 2008 is leap year d <- date_seq("2008/12/29", "2008/12/31", step="minute")
#> The following are leap years 2008