timeRelative {splusTimeDate} | R Documentation |
Constructor Function for timeRelative Class
Description
Construct a timeRelative
object.
Usage
timeRelative(x, holidays., by, k.by=1, align.by=FALSE, week.day=NULL)
Arguments
x |
a character string vector representing relative times. |
holidays. |
a time/date or time sequence object giving holiday dates. |
by |
as an alternate to providing a character string vector,
you can provide
"milliseconds" "ms" "seconds" or "sec" "minutes" or "min" "hours" or "hr" "days" or "day" "weekdays" or "wkd" "bizdays" or "biz" "weeks" or "wk" "tdy" (for 10-day periods in a month) "months" or "mth" "quarters" or "qtr" "years" or "yr" To add or subtract specific days of the week, use "sun" "mon" "tue" "wed" "thu" "fri" "sat" See |
k.by |
a non-zero integer specifying the number of |
align.by |
a logical value. If |
week.day |
if not |
Value
returns a timeRelative
object with the given strings
as data, and holidays, if given.
Otherwise, the strings default to empty, and the holidays to no holidays.
See Also
Examples
# Create a relative time object that you could add to a time/date object
# to take each element to the third Friday of the month
rtobj <- timeRelative("-a0mth -1fri +3fri")
timeDate(c("1/5/1998", "2/26/1998"), format = "%a %m/%d/%Y") + rtobj
# Create a relative time object for 3 minutes
timeRelative(by="minutes", k.by=3)