track_change: Track all changes for codes from API

View source: R/track-change.R

track_changeR Documentation

Track all changes for codes from API

Description

Track all code changes until current year or the year specified in to argument. The column oldCode could have several codes if it has changed many times until it becomes the code in newCode. When no code change has taken place, NA will be used.

Usage

track_change(
  type = c("fylke", "okonomisk", "kommune", "bydel", "levekaar", "grunnkrets"),
  from = NULL,
  to = NULL,
  names = TRUE,
  fix = FALSE
)

Arguments

type

Type of regional granularity ie. fylke, kommune etc.

from

Specify the starting year for range period. Current year is the default.

to

Specify the year to end the range period. Current year is used when not specified.

names

Include names. Default is TRUE

fix

Default is FALSE. When TRUE then use external codes to fix geo changes manually. The codes is sourced from config files depending on the granularity levels.

Value

A dataset of class data.table consisting all older codes from previous years until the selected year in to argument and what these older codes were changed into. If the codes have not changed then the value of old code will be NA.

Examples

mydata <- track_change("kommune", from = 2017, to = 2018)


helseprofil/norgeo documentation built on Oct. 20, 2024, 1:26 p.m.