Learn R Programming

hydroTSM (version 0.3-4)

dip: Days in Period

Description

Given any starting and ending dates, it generates: 1) a vector of class Date with all the days between the two dates, OR 2) the amount of days between the two dates

Usage

dip(from, to, date.fmt = "%Y-%m-%d", out.type = "seq")

Arguments

from
Character indicating the starting date for creating the sequence. It has to be in the format indicated by date.fmt.
to
Character indicating the ending date for creating the sequence. It has to be in the format indicated by date.fmt.
date.fmt
character indicating the format in which the dates are stored in dates, e.g. %Y-%m-%d. See format in as.Date. ONLY required when class(dates)=="factor" o
out.type
Character indicating the type of result that is given by this function. Valid values are: 1) seq : a vector of class Date with all the days between the two dates, OR 2) nmbr: a single numeric value with the amount of days between t

Value

  • Depending on the value of out.type, it returns: 1) a vector of class Date with all the days between the two dates, OR 2) the amount of days between the two dates

See Also

mip, yip, diy

Examples

Run this code
## Sequence of daily dates between "1961-01-01" and "1961-12-31" ##
dip("1961-01-01", "1961-12-31")

## Number of days between "1961-01-01" and "1965-06-30", 
## but using "\%d-\%m-\%Y" as date format.
dip("01-01-1961", "30-06-1965", date.fmt= "%d-%m-%Y", out.type = "nmbr")

Run the code above in your browser using DataLab