Learn R Programming

pcts (version 0.15.8)

Cyclic: Create objects from class Cyclic

Description

Create objects from class Cyclic.

Usage

Cyclic(cycle, start = NULL, ...)

# S3 method for Cyclic as.Date(x, ...)

# S3 method for Cyclic date(x)

# S3 method for PeriodicTimeSeries as.Date(x, ...)

Value

for Cyclic, an object 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 to pcCycle, used only if cycle 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

Run this code
## bare bone Cyclic starting at Cycle 1, season 1
Cyclic(4)    
Cyclic(4, c(1,1)) # same

## with quarter/year cycle
qu <- Cyclic(BuiltinCycle(4), start = c(2020, 1))
start(qu)
as_datetime(qu)

date(qu) <- c(2009, 2)
qu

ap <- pcts(AirPassengers)
as.Date(ap)

Run the code above in your browser using DataLab