match_region_codes: Match to potential region codes

View source: R/set_region_codes.R

match_region_codesR Documentation

Match to potential region codes

Description

Given a region code in "nonstandard" format, matches all "standardized" region codes that it could denote. Works by first reducing the region code to a double and then matching all region codes of all region levels that when reduced to double are the same.

Usage

match_region_codes(
  x,
  year = NULL,
  region_level = NULL,
  offline = TRUE,
  use_char_length_info = NULL
)

match_region_codes_internal(
  x,
  key,
  region_level = NULL,
  use_char_length_info = NULL
)

Arguments

x

input code

year

double, year of classification

region_level

character (vector) region level of the input codes

offline

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

use_char_length_info

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

Details

If given a region code in "standardized" format, returns the input as such. That is, region codes in standardized format have unique matches.

By setting year you can restrict the domain of potential matches to region codes in use in specific year. When year is not set, latest classifications are used.

By setting region_level you can restrict the domain of potential matches to specific region levels.

Value

vector

Functions

  • match_region_codes_internal(): Match single region code. For internal use.


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