set_month_to_NA: Set Periods to NA

View source: R/set_month_to_NA.R

set_month_to_NAR Documentation

Set Periods to NA

Description

This function is typically used to discard information in non-quarter month. I.e., data is only kept in January, April, July and December and otherwise set to NA. In combination with m_to_q this function is useful to turn monthly series into quarterly series by letting the quarter month values represent the entire quarter. This can be useful when data was interpolated because of mixing data of different frequencies and needs to be converted back to a regular, quarterly time series.

Usage

set_month_to_NA(series, keep_month = c(1, 4, 7, 10))

Arguments

series

ts object

keep_month

integer vector denoting the months that not be set to NA. Defaults to c(1,4,7,10)

Examples

tsq <- ts(1:20,start=c(1990,1),frequency = 4)
aa <- tsqm(tsq)
m_to_q(set_month_to_NA(aa))


tstools documentation built on June 7, 2023, 5:13 p.m.