Produce period-level summary statistics from the snapshot store
for any combination of variables and summary functions. Returns
a tibble suitable for ggplot2 or as_brreg_tsibble() conversion.
Arguments
- .vars
Character vector of column names to aggregate.
NULL(default) counts entities per period.- .fns
Named list of summary functions applied to each column in
.vars. Default:list(total = \(x) sum(x, na.rm = TRUE)). Uselist(avg = mean, sd = sd)for multiple summaries. Output columns are named{variable}_{function}.- by
Character vector of grouping column names (e.g.
"nace_1",c("legal_form", "municipality_code")).NULLfor national totals.- frequency
One of
"year","quarter","month".- from, to
Start and end dates for the panel.
NULLdefaults to the range of available snapshots.- type
One of
"enheter","underenheter","roller".- label
Logical. Translate group codes to English labels.
Value
A tibble with period (character), optional grouping
columns, and one column per variable-function combination.
Attribute brreg_panel_meta records metadata for
as_brreg_tsibble() conversion.
See also
brreg_panel() for entity-level panels,
as_brreg_tsibble() for tsibble conversion.
Other tidybrreg panel functions:
as_brreg_tsibble(),
brreg_change_summary(),
brreg_changes(),
brreg_events(),
brreg_flows(),
brreg_panel(),
brreg_replay()
Examples
if (FALSE) { # interactive() && requireNamespace("arrow", quietly = TRUE)
# \donttest{
brreg_series(.vars = "employees", by = "legal_form")
brreg_series(.vars = "employees",
.fns = list(avg = mean, total = sum),
by = "nace_1")
# }
}