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

calendar-align

Making a 'timeDate' object unique


Description

Aligns a 'timeDate' object to regular date/time stamps.

Usage

## S4 method for signature 'timeDate'
align(x, by = "1d", offset = "0s")

alignDaily(x, include.weekends=FALSE)
alignMonthly(x, include.weekends=FALSE)
alignQuarterly(x, include.weekends=FALSE)

Arguments

x

an object of class timeDate.

by

a character string formed from an integer length and a period identifyer. Valid values are "w", "d", "h", "m", "s", for weeks, days, hours, minutes and seconds. For example a bi-weekly period is expressed as "2w".

offset

a character string to set an offset formed from an integer length and a period identifyer in the same way as for the argument by.

include.weekends

logical value indicating whether 'weekends' should be included.

Details

The functions alignDaily, alignMonthly, alignMonthly are simple to use functions which generate end-of-day, end-of-month, and end-of quarter timeDate objects. Weekends are excluded by default. Optionally they can be added setting the argument include.weekends=TRUE.

Value

returns an object of class timeDate.

Examples

## align -

# Align Bi-Weekly with a 3 Days Offset:
(tC <- timeCalendar())
align(tC, by = "2w", offset = "3d")

## alignDaily -

# Simple to use Functions:
alignDaily(tC)
alignDaily(tC, include.weekends=TRUE)

# Align to end-of-month Dates:
alignMonthly(tC)

timeDate

Rmetrics - Chronological and Calendar Objects

v3043.102
GPL (>= 2)
Authors
Diethelm Wuertz [aut], Tobias Setz [cre], Yohan Chalabi [ctb], Martin Maechler [ctb], Joe W. Byers [ctb]
Initial release
2018-02-21

We don't support your browser anymore

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