Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

season

Extract the season info from a time series


Description

Extract the season info from a equally spaced time series and create a vector of the season info. For example for monthly data, the function outputs a vector containing the months of the data.

Usage

season(x, labels)

Arguments

x

a time series

labels

the user supplied labels for the seasons

Details

The time series must have frequency greater than 1, otherwise the function will stop and issue an error message. If labels is missing, labels will be set as follows: It is set to be c("1Q","2Q","3Q","4Q) if the frequency of x equals 4, c("January",...,"December") if the frequency equals 12, and c("Monday",...,"Sunday") if frequency equals 7. Otherwise, it is set to be c("S1",...)

Value

An invisible vector containing the seasons of the data

Author(s)

Kung-Sik Chan

See Also

Examples

data(tempdub)
month.=season(tempdub) # the period sign is included to make the printout from
# the commands two line below clearer; ditto below.
model2=lm(tempdub~month.-1) # -1 removes the intercept term 
summary(model2)

TSA

Time Series Analysis

v1.3
GPL (>= 2)
Authors
Kung-Sik Chan, Brian Ripley
Initial release
2020-9-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.