Skip to contents

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))
#>      Qtr1 Qtr2 Qtr3 Qtr4
#> 1990    1    2    3    4
#> 1991    5    6    7    8
#> 1992    9   10   11   12
#> 1993   13   14   15   16
#> 1994   17   18   19   20