allSeasons: Get names of seasons

allSeasonsR Documentation

Get names of seasons

Description

Functions and methods fo get names of seasons and related quantities for objects from the cycle, periodic time series classes and other objects for which the concepts are defined.

Usage

unitSeason(x)
unitCycle(x)
seqSeasons(x)
allSeasons(x, abb = FALSE, prefix = "S", ...)

unitSeason ( x, ... ) <- value
unitCycle ( x, ... ) <- value
allSeasons ( x, abb, ... ) <- value

## S4 replacement method for signature 'SimpleCycle'
allSeasons(x, abb, prefix, ...) <- value

## S4 replacement method for signature 'Cyclic'
allSeasons(x, abb = FALSE, ...) <- value

Arguments

x

a cycle, time series or other object for which the concept of seasons is defined.

abb

if TRUE give the abbreviated names of the seasons.

prefix

use this prefix for automatically generated names of seasons.

...

further arguments for methods.

value

a character string

Details

The cycle classes, i.e. classes inheriting from class BasicCycle, provide common functionality. In particular, they guarantee that the functions described in this topic are available. These functions work also for the periodic time series classes and may be defined for other classes where they make sense.

Methods

Methods for allSeasons():

signature(x = "BasicCycle", abb = "ANY")
signature(x = "DayWeekCycle", abb = "logical")
signature(x = "DayWeekCycle", abb = "missing")
signature(x = "MonthYearCycle", abb = "logical")
signature(x = "MonthYearCycle", abb = "missing")
signature(x = "OpenCloseCycle", abb = "logical")
signature(x = "OpenCloseCycle", abb = "missing")
signature(x = "QuarterYearCycle", abb = "logical")
signature(x = "QuarterYearCycle", abb = "missing")
signature(x = "SimpleCycle", abb = "ANY")
signature(x = "Cyclic", abb = "ANY")
signature(x = "Every30MinutesCycle", abb = "logical")
signature(x = "Every30MinutesCycle", abb = "missing")
signature(x = "VirtualPeriodicModel", abb = "ANY")

Author(s)

Georgi N. Boshnakov

Examples

opcycle <- new("OpenCloseCycle")
## convert to SimpleCycle to change some names
siopcycle <- as(opcycle, "SimpleCycle")
## siopcycle inherits names from opcycle
unitSeason(siopcycle)             # "Season"
unitCycle(siopcycle)              # "Cycle"
allSeasons(siopcycle)             # "Open"  "Close"
allSeasons(siopcycle, abb = TRUE) # "O" "C"

allSeasons(siopcycle) <- c("Day", "Night")
allSeasons(siopcycle) # now: "Day"   "Night"
## change also abbreviations
allSeasons(siopcycle, abb = TRUE) <- c("D", "N")
allSeasons(siopcycle, abb = TRUE) # now: "D" "N"

seasons <- new("SimpleCycle", 4)
unitSeason(seasons)             # "Season"
unitCycle(seasons)              # "Cycle"
allSeasons(seasons)
allSeasons(seasons, abb = TRUE) 

unitCycle(seasons) <- "Year"
unitCycle(seasons)
allSeasons(seasons) <- c("Winter", "Spring", "Summer", "Autumn")
allSeasons(seasons)
allSeasons(seasons, abb = TRUE) <- c("Win", "Spr", "Sum", "Aut")
allSeasons(seasons, abb = TRUE)

## change autumn to Fall
allSeasons(seasons)[4] <- "Fall"
allSeasons(seasons, abb = TRUE)[4] <- "Fal"
allSeasons(seasons)
allSeasons(seasons, abb = TRUE)

## indexing of cycle objects is equivalent to allSeasons.
seasons[]
seasons[ , abb = TRUE]

seasons[4] <- "Herbst"
seasons

unitCycle(seasons) <- "Jahre"
unitCycle(seasons)
unitSeason(seasons) <- "Jahreszeit"
seasons[] <- c("Winter", "Frueling", "Sommer", "Herbst")
seasons[ , abb = TRUE] <- c("W", "F", "S", "H")
seasons[]
seasons

GeoBosh/pcts documentation built on Dec. 8, 2023, 9:57 p.m.