Use API data

This is a simple guide to access data via API. Regional granularity levels includes:

Download data with API

All functions that have get_ prefix access data directly via SSB API. This is the simple guide to use norgeo API function to get codes for municipalities with selected time period:

dt <- get_code("kommune", from = 2015, to = 2021)
# only current geo code
dt <- get_code("kommune", from = 2021)

You could download geo code changes via get_change() function. The example below will download municipalities codes that have changed from 2015 to 2021.

dtc <- get_change("kommune", from = 2015, to = 2021)

Track geo changes

To track all municipalities codes that have changed since 2015 to their current codes as in 2021 can be done as follows:

dtt <- track_change("kommune", from = 2015, to = 2021)

The difference between get_change() and track_change() is that, the former will only download codes that have changed while the latter will, in addition, track these changes to the current codes.

You can also track geo codes that are split or merged to a new geo with function track_split() or track_merge().