timeRelative(x, holidays., by, k.by=1, align.by=FALSE, week.day=NULL)
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 by,
k.by, align.by,
and week.day if you need to construct
a timeRelative object.
by is one of the following character strings, giving the time units for the relative time: "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 timeRelative-class for more information on these arguments. |
k.by | a non-zero integer specifying the number of by time units in the relative time. |
align.by | a logical value. If TRUE, specifies using alignment (see documentation on the relative time class). |
week.day | if not NULL, and by is "weeks", you can supply a character string (or an integer 0 to 6, with 0 being Sunday) to specify a weekday for the relative time. The character string must be sufficient to make a unique case-insensitive match to the strings in timeDateOptions("time.day.name"). |
# 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)