Classifies Chinese administrative area codes into different categories, including province, city, area type, and registry information.

classify_areacode(x)

Arguments

x

A vector of six-digit Chinese administrative area codes as numeric or character.

Value

A list containing the following elements:

  • areacode: The input area code with invalid codes replaced by NA.

  • registry: The registry code corresponding to the area code.

  • province: The province-level area code (first two digits + "0000").

  • city: The city-level area code (first four digits + "00").

  • area_type: The area type classification ("910000" for urban, "920000" for rural).

  • region: The regional classification code.

Examples

classify_areacode(c("110000", "320500", "440300"))
#> $areacode
#> [1] "110000" "320500" "440300"
#> 
#> $registry
#> [1] "110000" "320500" "440300"
#> 
#> $province
#> [1] "110000" "320000" "440000"
#> 
#> $city
#> [1] "110000" "320500" "440300"
#> 
#> $area_type
#> [1] "910000" "910000" "910000"
#> 
#> $region
#> [1] "720000" "740000" "760000"
#>