Skip to contents

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", "kommune", "bydel", "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)
#> 
#> Please check splitting geo codes with `track_split()` for possible error
#> Use `fix = TRUE` to implement the way we do it in our work. Please read the documentation