View source: R/set_month_to_NA.R
set_month_to_NA | R Documentation |
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.
set_month_to_NA(series, keep_month = c(1, 4, 7, 10))
series |
ts object |
keep_month |
integer vector denoting the months that not be set to NA. Defaults to c(1,4,7,10) |
tsq <- ts(1:20,start=c(1990,1),frequency = 4)
aa <- tsqm(tsq)
m_to_q(set_month_to_NA(aa))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.