Build an unbalanced firm × period panel from the Hive-partitioned
snapshot store. For each target period, selects the most recent
prior snapshot (LOCF). Requires at least two snapshots saved via
brreg_snapshot() or brreg_import().
Arguments
- frequency
One of
"year"(default),"quarter","month", or"custom". For"custom", supply target dates viadates.- cols
Character vector of column names to include.
NULL(default) returns all columns mapped by field_dict.- from, to
Start and end dates for the panel.
NULLdefaults to the range of available snapshots.- dates
Date vector for
frequency = "custom".- max_gap
Integer. Maximum number of periods a snapshot may carry forward via LOCF.
NULL(default) carries forward indefinitely. Setmax_gap = 2to prevent a quarterly snapshot from representing a firm as active 3+ quarters after its last observation.- type
One of
"enheter"or"underenheter".- label
Logical. If
TRUE, applybrreg_label()to the result.
Value
A tibble with columns: org_nr, period (character label
for the period), snapshot_date (the actual snapshot used),
plus requested cols. Attribute date_mapping records which
snapshot was used for each period.
See also
brreg_snapshot() to accumulate snapshots,
brreg_events() for change detection between snapshots.
Other tidybrreg panel functions:
as_brreg_tsibble(),
brreg_change_summary(),
brreg_changes(),
brreg_events(),
brreg_flows(),
brreg_replay(),
brreg_series()
Examples
if (FALSE) { # interactive() && requireNamespace("arrow", quietly = TRUE)
# \donttest{
# Annual panel of all entities
panel <- brreg_panel()
# Monthly panel for specific columns
panel <- brreg_panel("month", cols = c("employees", "nace_1", "legal_form"))
# }
}