get_last_n_obs: Get last high frequency observations

Description Usage Arguments Details Value Examples

View source: R/midas_processing.R

Description

Get last high frequency observations

Usage

1
get_last_n_obs(hf_data, lf_date, n_lags = 1, one_row = TRUE)

Arguments

hf_data

high frequency data

lf_date

low frequency date

n_lags

number of lags to add

one_row

output representation

Details

Get last high frequency observations. The function cuts n_lags observations from the table hf_data, that are from the same day or before as the date indicated by lf_date. If one_row is TRUE the result is stacked in a row, otherwise the result is a column.

Value

tsibble with high frequency lags added

Examples

1
2
3
4
hf_data <- tibble::tibble(date = lubridate::ymd("2011-01-01") +
           lubridate::days(0:60), observations = rnorm(61))
get_last_n_obs(hf_data, "2011-02-23", n_lags = 7,
           one_row = FALSE)

kassandra-ru/kassandr documentation built on Jan. 1, 2022, 7:39 a.m.