Create objects from class Cyclic
Cyclic.Rd
Create objects from class Cyclic.
Arguments
- cycle
-
a cycle object, a positive integer giving the number of seasons, or any other object that can be used to create a cycle with
pcCycle(x, ...)
. - start
-
a cycle-season pair, a datetime object, a Date object or any object that can be converted to datetime with
as_datetime(start)
. - ...
-
for
Cyclic
, arguments passed topcCycle
, used only ifcycle
is not from a cycle class. - x
a Cyclic object
See also
BuiltinCycle
, pcCycle
for creation of cycle objects,
pcts
importing and creating periodic time series
Examples
## bare bone Cyclic starting at Cycle 1, season 1
Cyclic(4)
#> Start: 1 S1
#> Cycle: BareCycle
#> Number of seasons: 4
Cyclic(4, c(1,1)) # same
#> Start: 1 S1
#> Cycle: BareCycle
#> Number of seasons: 4
## with quarter/year cycle
qu <- Cyclic(BuiltinCycle(4), start = c(2020, 1))
start(qu)
#> [1] 2020 1
as_datetime(qu)
#> [1] "2020-01-01 UTC"
date(qu) <- c(2009, 2)
qu
#> Start: 2009 Quarter_2
#> Cycle: QuarterYearCycle
#> Number of seasons: 4
ap <- pcts(AirPassengers)
as.Date(ap)
#> [1] "1949-01-01" "1949-02-01" "1949-03-01" "1949-04-01" "1949-05-01"
#> [6] "1949-06-01" "1949-07-01" "1949-08-01" "1949-09-01" "1949-10-01"
#> [11] "1949-11-01" "1949-12-01" "1950-01-01" "1950-02-01" "1950-03-01"
#> [16] "1950-04-01" "1950-05-01" "1950-06-01" "1950-07-01" "1950-08-01"
#> [21] "1950-09-01" "1950-10-01" "1950-11-01" "1950-12-01" "1951-01-01"
#> [26] "1951-02-01" "1951-03-01" "1951-04-01" "1951-05-01" "1951-06-01"
#> [31] "1951-07-01" "1951-08-01" "1951-09-01" "1951-10-01" "1951-11-01"
#> [36] "1951-12-01" "1952-01-01" "1952-02-01" "1952-03-01" "1952-04-01"
#> [41] "1952-05-01" "1952-06-01" "1952-07-01" "1952-08-01" "1952-09-01"
#> [46] "1952-10-01" "1952-11-01" "1952-12-01" "1953-01-01" "1953-02-01"
#> [51] "1953-03-01" "1953-04-01" "1953-05-01" "1953-06-01" "1953-07-01"
#> [56] "1953-08-01" "1953-09-01" "1953-10-01" "1953-11-01" "1953-12-01"
#> [61] "1954-01-01" "1954-02-01" "1954-03-01" "1954-04-01" "1954-05-01"
#> [66] "1954-06-01" "1954-07-01" "1954-08-01" "1954-09-01" "1954-10-01"
#> [71] "1954-11-01" "1954-12-01" "1955-01-01" "1955-02-01" "1955-03-01"
#> [76] "1955-04-01" "1955-05-01" "1955-06-01" "1955-07-01" "1955-08-01"
#> [81] "1955-09-01" "1955-10-01" "1955-11-01" "1955-12-01" "1956-01-01"
#> [86] "1956-02-01" "1956-03-01" "1956-04-01" "1956-05-01" "1956-06-01"
#> [91] "1956-07-01" "1956-08-01" "1956-09-01" "1956-10-01" "1956-11-01"
#> [96] "1956-12-01" "1957-01-01" "1957-02-01" "1957-03-01" "1957-04-01"
#> [101] "1957-05-01" "1957-06-01" "1957-07-01" "1957-08-01" "1957-09-01"
#> [106] "1957-10-01" "1957-11-01" "1957-12-01" "1958-01-01" "1958-02-01"
#> [111] "1958-03-01" "1958-04-01" "1958-05-01" "1958-06-01" "1958-07-01"
#> [116] "1958-08-01" "1958-09-01" "1958-10-01" "1958-11-01" "1958-12-01"
#> [121] "1959-01-01" "1959-02-01" "1959-03-01" "1959-04-01" "1959-05-01"
#> [126] "1959-06-01" "1959-07-01" "1959-08-01" "1959-09-01" "1959-10-01"
#> [131] "1959-11-01" "1959-12-01" "1960-01-01" "1960-02-01" "1960-03-01"
#> [136] "1960-04-01" "1960-05-01" "1960-06-01" "1960-07-01" "1960-08-01"
#> [141] "1960-09-01" "1960-10-01" "1960-11-01" "1960-12-01"