Class PartialCycle
PartialCycle-class.Rd
Class PartialCycle
Objects from the Class
Objects can be created by calls of the form new("PartialCycle", ...)
.
Partial cycles are often created implicitly when subsetting time series
using window()
with argument seasons
, see the examples.
Slots
orig
:the parent class of the partial cycle, an object inheriting from class
"BasicCycle"
.subindex
:an integer vector specifying the seasons to include in the partial cycle.
Extends
Class "BasicCycle"
, directly.
Methods
- allSeasons
signature(x = "PartialCycle", abb = "logical")
: ...- allSeasons
signature(x = "PartialCycle", abb = "missing")
: ...- nSeasons
signature(object = "PartialCycle")
: ...- unitCycle
signature(x = "PartialCycle")
: ...- unitSeason
signature(x = "PartialCycle")
: ...
Examples
dwc <- new("DayWeekCycle")
dwc
#> Object from built-in class 'DayWeekCycle'
#> Cycle start: Monday
allSeasons(dwc)
#> [1] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"
#> [7] "Sunday"
## a five day week cycle
dwc5 <- new("PartialCycle", orig = dwc, subindex = 1:5)
dwc5
#> Object from class 'PartialCycle'
#> partial cycle of 'DayWeekCycle', seasons: 1, 2, 3, 4, 5
#> Cycle start: Monday
allSeasons(dwc5)
#> [1] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
weekend <- new("PartialCycle", orig = dwc, subindex = 6:7)
weekend
#> Object from class 'PartialCycle'
#> partial cycle of 'DayWeekCycle', seasons: 6, 7
#> Cycle start: Saturday
allSeasons(weekend)
#> [1] "Saturday" "Sunday"
ap <- pcts(AirPassengers)
## take data for the summer months (in Northern hemisphere)
ap7to9 <- window(ap, seasons = 7:9)
## the above implicitly creates a partial cycle
ap7to9
#> An object of class "PeriodicTS"
#> Slot "cycle": Start: 1949 July
#> Cycle: PartialCycle
#> Number of seasons: 3
#>
#> Jul Aug Sep
#> Y1949 148 148 136
#> Y1950 170 170 158
#> Y1951 199 199 184
#> Y1952 230 242 209
#> Y1953 264 272 237
#> Y1954 302 293 259
#> Y1955 364 347 312
#> Y1956 413 405 355
#> Y1957 465 467 404
#> Y1958 491 505 404
#> Y1959 548 559 463
#> Y1960 622 606 508
allSeasons(ap7to9)
#> [1] "July" "August" "September"