Recode a vector of US locations from one format to another
Source:R/recode_locations.R
us_location_recode.RdUses us_location_lookup() to perform recoding.
Arguments
- location
vector of location values
- location_input_format
format in which the location vector is coded. See
to_us_location_table_column()for permitted formats. Must be a single value.- location_output_format
Code the output vector in this format. See
to_us_location_table_column()for permitted formats. Must be a single value.
Examples
us_location_recode(c("01", "05", "US", "05"), "code", "name")
#> [1] "Alabama" "Arkansas" "United States" "Arkansas"
us_location_recode(c("AK", "US", "HI", "AK"), "abbr", "code")
#> [1] "02" "US" "15" "02"
us_location_recode(c("AK", "US", "HI", "AK"), "abbr", "hrd")
#> [1] "AK" "USA" "HI" "AK"
us_location_recode("AK", "abbr", "name")
#> [1] "Alaska"