get_regionkey: Get region classification key

View source: R/get_region_classifications.R

get_regionkeyR Documentation

Get region classification key

Description

Imports region classification keys from Statistics Finland API. A wrapper for get_key() that it calls under the hood.

Usage

get_regionkey(
  ...,
  year = NULL,
  only_codes = FALSE,
  only_names = FALSE,
  lang = "fi",
  offline = TRUE
)

Arguments

...

character(s), the regions to include in the key.

year

character or numerical, the year of the desired classification key.

only_codes

logical, whether the key should contain only the region codes. Defaults to FALSE.

only_names

logical, whether the key should contain only the region names. Defaults to FALSE.

lang

"fi", "sv" or "en". Language of the key required. Defaults to "fi".

offline

logical, whether uses the key in the package data. Defaults TRUE.

Details

The classification keys e.g. from seutukunta to maakunta or maakunta to suuralue are not very well available. Thus, the logic of the function is to first get all keys from kunta to all other regions, construct a table that contains all municipalities with their corresponding larger regions and then apply the selection implied by the arguments set by the user possible removing duplicates. get_regionkey() can thus also construct keys that are not available in the Statistics Finland classification keys API.

Value

Region classification key as a data.frame.

Examples


get_regionkey()
get_regionkey("kunta", "seutukunta", only_codes = TRUE)


pttry/statficlassifications documentation built on Jan. 17, 2024, 4:36 p.m.