convert_state_names: Convert state names among full, lowercase, and abbreviation

View source: R/convert_state_names.R

convert_state_namesR Documentation

Convert state names among full, lowercase, and abbreviation

Description

Also include other areas such as Puerto Rico and Guam, and even United states for dealing with census data. Examples of state names: full – "District of Columbia", "Kentucky"; lowercase – "district of columbia", "kentucky"; abbr – "DC", "KY".

Usage

convert_state_names(states, to)

Arguments

states

string, vector of state names to be converted.

to

string, format after convertion, take values of "full", "lowercase", and "abbr".

Value

a vector of converted state names

Examples

convert_state_names(c("Alabama",  "California","Connecticut"), "abbr")

# wrong names return NA and a warning
convert_state_names(c("DC", "AA","MA"), "full")



GL-Li/mytoolbox documentation built on May 16, 2024, 4:29 p.m.