Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

date.seq

date sequence


Description

creates date sequence given start and stop dates

Usage

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

Details

Please note that this is not a memory safe function that utilizes rasters out of memory in the manner that the raster package does.

Value

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

Author(s)

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")

# daily steps 1990/01/01 - 2019/12/31
d <- date.seq("1990/01/01", "2019/12/31", step="day")

# 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)

# daily step 2008/12/29 - 2008/12/31, 2008 is leap year
d <- date.seq("2008/12/29", "2008/12/31")

# minutes step 2008/12/29 - 2008/12/31, 2008 is leap year
d <- date.seq("2008/12/29", "2008/12/31", step="minute")

spatialEco

Spatial Analysis and Modelling Utilities

v1.3-6
GPL-3
Authors
Jeffrey S. Evans [aut, cre], Melanie A. Murphy [ctb], Karthik Ram [ctb]
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.