codes_to_names: Change region codes to region names

View source: R/region_codes_and_names.R

codes_to_namesR Documentation

Change region codes to region names

Description

Why do these functions exist? Replace by recode_region? Also:

Usage

codes_to_names(
  x,
  year = NULL,
  region_level = NULL,
  use_char_length_info = NULL,
  set_region_codes = FALSE,
  lang = "fi",
  offline = TRUE
)

Arguments

x

a character (vector) of region codes

year

integer, the year of the applied classification key.

region_level

character, optional region level of the input region codes

use_char_length_info

TRUE or named vector, whether to use code character length information in determining their region level. Defaults to NULL.

set_region_codes

logical, whether tries to set standard region codes. Defaults to FALSE.

lang

"fi", "sv" or "en". Language of output names. Defaults to "fi".

offline

logical, whether works offline with package data. Defaults to TRUE.

Details

key_recode(v, get_regionclassification(), by = "values")

Works with standardized region codes. A good practice is to first standardize your region codes using set_region_codes(). codes_to_names(), however can check if the region codes are standardized and applies set_region_codes() if they are not.

Value

data.frame

Examples


  v <- c("SSS", "KU103", "KU061","SK213", "MK04")
  codes_to_names(v)
  v <- c("SSS", "KU103", "KU061","SK213", "MK04", "nav9w4t")
  codes_to_names(v)
  f <- factor(c("SSS", "KU103", "KU061","SK213", "MK04"))
  codes_to_names(f)


pttry/statficlassifications documentation built on Sept. 17, 2024, 12:10 p.m.