File: calendar-periods.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 (71 lines) | stat: -rw-r--r-- 1,430 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
\name{periods}


\title{Rolling periods}


\alias{periods}
\alias{periodicallyRolling}
\alias{monthlyRolling}



\description{

    Returns start and end dates for a rolling periods

}


\usage{
periods(x, period = "12m", by = "1m", offset = "0d")
periodicallyRolling(x, period = "52w", by = "4w", offset = "0d")
monthlyRolling(x, period = "12m", by = "1m")
}


\arguments{

    \item{x}{
        an object of class timeDate.
    }

    \item{period}{
        a span string, consisting of a length integer
        and a unit value, e.g. "52w" for 52 weeks.}
    \item{by}{
        a span string, consisting of a length integer
        and a unit value, e.g. "4w" for 4 weeks.
    }
    \item{offset}{
        a span string, consisting of a length integer
        and a unit value, e.g. "0d" for no offset.
    }
}

\details{

 Periodically Rolling - Allowed unit values are "m" for 4 weeks, "w" for
 weeks, "d" for days, "H" for hours, "M" for minutes, and "S" for
 seconds.

 Monthly Calendar Rolling - The only allowed allowed unit value is "m"
 for monthly periods. Express a quarterly period by "3m", a semester by
 "6m", a year by "12m" etc.

}

\examples{
## Create Time Sequence -
   x <- timeSequence(from = "2001-01-01", to = "2009-01-01", by = "day")

## Generate Periods -
   periods(x, "12m", "1m")
   periods(x, "52w", "4w")

## Roll Periodically -
   periodicallyRolling(x)

## Roll Monthly -
   monthlyRolling(x)
}