BuiltinCycle-class | R Documentation |
"BuiltinCycle"
and its subclasses in package 'pcts'Class "BuiltinCycle"
and its subclasses in package 'pcts'.
Class "BuiltinCycle"
is a virtual Class: no objects may be
created from it. Class "BuiltinCycle"
has several built-in
cycle subclasses. Objects from the subclasses can be created by calls
of the form new("className", first, ...)
, where
"className"
is the name of the subclass. The optional argument
first
can be used to designate a season to be considered first
in the cycle, by default the first.
The function BuiltinCycle
provides a more convenient way
to generate objects from subclasses of class
"BuiltinCycle"
. Its argument is the number of seasons.
These classes are effectively unmodifiable, but the user can convert them to other cycle classes, e.g. class "SimpleCycle", and adapt as needed.
The subclasses of "BuiltinCycle"
have definitions for all
methods promised by its superclass "BasicCycle"
.
Currently, the following builtin classes are defined:
Name | Description | nSeasons |
"DayWeekCycle" | weekdays | 7 |
"QuarterYearCycle" | quarters in a year | 4 |
"MonthYearCycle" | months in a year | 12 |
"Every30MinutesCycle" | half-hour intervals in a day | 48 |
"OpenCloseCycle" | start/end of a working day | 2 |
There is also a class "FiveDayWeekCycle"
but it is deprecated
and will be removed in the near future. Use BuiltinCycle(5)
to create objects with equivalent functionality.
The class "BuiltinCycle"
and its subclasses have a single
common slot:
first
:Object of class "integer"
,
the index of the season to be treated as the first in a cycle.
Class "BuiltinCycle"
extends class
"BasicCycle"
, directly.
Classes "DayWeekCycle"
, "Every30MinutesCycle"
,
"FiveDayWeekCycle"
, "OpenCloseCycle"
and
"QuarterYearCycle"
extend:
Class "BuiltinCycle"
, directly.
Class "BasicCycle"
, by class "BuiltinCycle", distance 2.
Functions with methods for this class:
signature(from = "BuiltinCycle", to = "BareCycle")
: ...
signature(from = "BuiltinCycle", to = "SimpleCycle")
: ...
signature(.Object = "BuiltinCycle")
: ...
signature(object = "BuiltinCycle")
: ...
The functions to extract properties from objects from the builtin
cycle classes have identical signatures (except for the name of the
class). For example, for "QuarterYearCycle"
the methods are as
follows:
signature(x = "QuarterYearCycle", abb = "logical")
: ...
signature(x = "QuarterYearCycle", abb = "missing")
: ...
signature(object = "QuarterYearCycle")
: ...
signature(x = "QuarterYearCycle")
: ...
signature(x = "QuarterYearCycle")
: ...
The methods for the remaining builtin classes are the same with
"QuarterYearCycle"
replaced suitably.
Georgi N. Boshnakov
BuiltinCycle
,
pcCycle
for creation of cycle objects and extraction of
cycle part of time series,
class PartialCycle
for creating variants of the
builtin classes, e.g., 5-day weeks.
BareCycle-class
,
SimpleCycle-class
,
## class "DayWeekCycle"
dwcycle <- BuiltinCycle(7) # new("DayWeekCycle")
unitSeason(dwcycle)
unitCycle(dwcycle)
allSeasons(dwcycle)
dwcycle[] # same
allSeasons(dwcycle, abb = TRUE)
dwcycle[ , abb = TRUE] # same
dwcycle[2]
dwcycle[2, abb = TRUE]
seqSeasons(dwcycle)
## start the week on Sunday
dws <- BuiltinCycle(7, first = 7) # new("DayWeekCycle", first = 7)
dws[1] # "Sunday"
allSeasons(dws)
## class "Every30MinutesCycle"
cyc48 <- BuiltinCycle(48) # new("Every30MinutesCycle")
nSeasons(cyc48)
allSeasons(cyc48)
## class "FiveDayWeekCycle" is deprecated, use the equivalent:
fdcycle <- BuiltinCycle(5)
unitSeason(fdcycle)
unitCycle(fdcycle)
allSeasons(fdcycle)
fdcycle[] # same
allSeasons(fdcycle, abb = TRUE)
fdcycle[ , abb = TRUE] # same
fdcycle[2]
fdcycle[2, abb = TRUE]
seqSeasons(fdcycle)
## class "MonthYearCycle"
mycycle <- BuiltinCycle(12) # new("MonthYearCycle")
unitSeason(mycycle)
unitCycle(mycycle)
allSeasons(mycycle)
mycycle[ ] # same
allSeasons(mycycle, , abb = TRUE)
mycycle[ , abb = TRUE] # same
mycycle[2]
mycycle[2, abb = TRUE]
seqSeasons(mycycle)
## class "OpenCloseCycle"
opcycle <- new("OpenCloseCycle")
unitSeason(opcycle)
unitCycle(opcycle)
allSeasons(opcycle)
opcycle[ , abb = FALSE] # same
allSeasons(opcycle, abb = FALSE)
opcycle[] # same
opcycle[2]
opcycle[2, abb = TRUE]
seqSeasons(opcycle)
## class "QuarterYearCycle"
qycycle <- new("QuarterYearCycle")
unitSeason(qycycle)
unitCycle(qycycle)
allSeasons(qycycle)
qycycle[] # same
allSeasons(qycycle, abb = TRUE)
qycycle[ , abb = TRUE] # same
qycycle[2]
qycycle[2, abb = TRUE]
seqSeasons(qycycle)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.