Skip to contents

Convert the output of brreg_panel() or brreg_series() to a tsibble for use with the tidyverts ecosystem (fable, feasts, slider). Uses regular = FALSE since brreg snapshots are irregularly spaced.

Usage

as_brreg_tsibble(x, key = NULL, index = NULL)

Arguments

x

A tibble from brreg_panel() or brreg_series().

key

Character vector of key column(s). For panels, typically "org_nr". For series, the grouping variable (e.g. "legal_form"). If NULL, inferred from the brreg_panel_meta attribute.

index

Character. Name of the time index column. Default "period" for series output, "snapshot_date" for panel output.

Value

A tsibble.

Examples

if (FALSE) { # interactive() && requireNamespace("tsibble", quietly = TRUE)
# \donttest{
panel <- brreg_panel(cols = c("employees", "legal_form"))
as_brreg_tsibble(panel)
# }
}