File: calendar-align.Rd

package info (click to toggle)
r-cran-timedate 3012.100-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 2,592 kB
  • ctags: 4
  • sloc: makefile: 13
file content (93 lines) | stat: -rw-r--r-- 1,743 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
\name{align}


\title{Making a 'timeDate' object unique}


\alias{align}
\alias{align,timeDate-method}
\alias{align,ANY-method}

\alias{alignDaily}
\alias{alignMonthly}
\alias{alignQuarterly}


\description{

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

}


\usage{
\S4method{align}{timeDate}(x, by = "1d", offset = "0s")

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


\arguments{
  \item{x}{
    an object of class \code{timeDate}.
  }
  \item{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 \code{"2w"}.
  }
  \item{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 \code{by}.
  }
  \item{include.weekends}{
    logical value indicating whether 'weekends' should be
    included.
  }
}


\details{

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

}

\value{

  returns an object of class \code{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)

}


\keyword{chron}