subset.ts

0th

Percentile

Subsetting a time series

Extracts the values of a specific season or subset of seasons in each year. For example, to extract all values for the month of May from a time series.

Keywords
ts
Usage
"subset"(x, subset=NULL, month=NULL, quarter=NULL, season=NULL, ...)
Arguments
x
a univariate time series to be subsetted
subset
optional logical expression indicating elements to keep; missing values are taken as false. subset must be the same length as x.
month
Numeric or character vector of months to retain. Partial matching on month names used.
quarter
Numeric or character vector of quarters to retain.
season
Numeric vector of seasons to retain.
...
Other arguments, unused.
Details

If character values for months are used, either upper or lower case may be used, and partial unambiguous names are acceptable. Possible character values for quarters are "Q1", "Q2", "Q3", and "Q4".

Value

subset is used, a numeric vector is returned with no ts attributes. Otherwise, a ts object is returned with frequency equal to the length of month, quarter or season.

See Also

subset

Aliases
  • subset.ts
Examples
subset(woolyrnq,quarter=3)
Documentation reproduced from package forecast, version 7.2, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.