Skip to contents

Returns a filtered view of all recorded changes across the four sync streams: enheter, underenheter, roller, and påtegninger. Every call to brreg_sync() appends events to the changelog; this function reads and filters them.

Usage

brreg_changes(
  track = NULL,
  registry = NULL,
  change_type = NULL,
  from = NULL,
  to = NULL,
  org_nr = NULL
)

Arguments

track

Character vector of fields to include (e.g. c("nace_1", "municipality_code", "employees")). NULL returns all fields.

registry

Character vector of streams to include. Default includes all four.

change_type

Character vector of event types to include. Options: "entry", "exit", "change", "annotation_added", "annotation_cleared".

from, to

Date range (inclusive).

org_nr

Optional character vector of organisation numbers.

Value

A tibble with columns: timestamp, org_nr, registry, change_type, field, value_from, value_to, update_id.

See also

brreg_sync() to populate the changelog, brreg_flows() for aggregated entry/exit counts.

Other tidybrreg panel functions: as_brreg_tsibble(), brreg_change_summary(), brreg_events(), brreg_flows(), brreg_panel(), brreg_replay(), brreg_series()

Examples

if (FALSE) { # interactive()
# \donttest{
brreg_sync()

# All changes this month
brreg_changes(from = Sys.Date() - 30)

# NACE reclassifications only
brreg_changes(track = "nace_1", change_type = "change")

# Entries and exits for a specific entity
brreg_changes(org_nr = "923609016", change_type = c("entry", "exit"))

# All annotation events
brreg_changes(registry = "paategninger")
# }
}