detect_region_year: Detect year of region classification

View source: R/detect_region_variables.R

detect_region_yearR Documentation

Detect year of region classification

Description

Detects year of classification from the number of unique regions assuming the regularity that the number of regions weakly decreases in time. Given a vector of region names or codes and region level determines the year of regional classification. Returns all matching years. Works only for a vector that contains all possible values. Note that if the data does not contain all possible values the levels of a factor may.

Usage

detect_region_year(x, region_level)

Arguments

x

vector of regions

region_level

region level in x

Value

vector

Examples

   df <- get_regionclassification("kunta", year = 2010)
   detect_region_year(df$kunta_name, region_level = "kunta")


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