Closed sampoves closed 3 years ago
Hi, we could add a new variable municipality_code_char
for municipalities and in similar vein for other *_code
variants. Or we can add a new logical argument codes_as_character
that would output the codes as three/two character long character vectors.
The current output (as integers) has been done on purpose as the attribute data these functions has been used with (Kela registers) uses integers for such codes.
Any ideas?
Yes, I thought there must have been a purposeful decision behind this as the other get-prefixed functions in geofi do not have this issue. I would support implementing the logical argument codes_as_character
.
First version can be installed and tested with
devtools::install_github("ropengov/geofi", ref = "feature/codes_as_character")
Implemented here: https://github.com/rOpenGov/geofi/commit/a92f72ddc77676ae51421e319c7fb8b013cbedac
Any input, comments or fixes, greatly appreciated!
While elegant, the function affected also columns that needed no leading zeros - at least according to Tilastokeskus. For example, kielisuhde is just 0, 1, 2 or 3, not 00, 01, 02 or 03, according to https://www2.tilastokeskus.fi/fi/luokitukset/kielisuhde/
I put my proposed changes to PR #39
This is included in recent cran release https://cran.r-project.org/web/packages/geofi/index.html
According to Statistics Finland, municipality codes always have three digits and leading zeroes are used where needed. The same is true for regions, except there only two digits are used.
geofi::get_municipalities outputs these codes without the leading zeroes. These are the column names:
kunta
,maakunta_code
, andmunicipality_code
.As per Statistics Finland: https://www2.tilastokeskus.fi/fi/luokitukset/kunta/ https://www2.tilastokeskus.fi/fi/luokitukset/maakunta/