US_stateConversion: Conversion functions for US state names, codes and FIPS...

US_stateConversionR Documentation

Conversion functions for US state names, codes and FIPS codes.

Description

Converts a vector of US state names or codes from one system to another reuturning NA where no match is found.

Usage

US_stateCodeToName(stateCode = NULL)

US_stateCodeToFIPS(stateCode = NULL)

US_stateFIPSToName(stateFIPS = NULL)

US_stateFIPSToCode(stateFIPS = NULL)

US_stateNameToCode(stateName = NULL)

US_stateNameToFIPS(stateName = NULL)

Arguments

stateCode

Vector of ISO 3166-2 alpha-2 codes.

stateFIPS

Vector of two-digit FIPS codes.

stateName

Vector of English language state names.

Value

A vector of US state names or codes.

Examples

library(MazamaSpatialUtils)

US_stateNameToCode("Washington")
US_stateNameToFIPS("Washington")

postalCodes <- sample(US_stateCodes$stateCode, 30)

data.frame(
  name = US_stateCodeToName(postalCodes),
  code = postalCodes,
  FIPS = US_stateCodeToFIPS(postalCodes)
)


MazamaSpatialUtils documentation built on Sept. 8, 2023, 5:22 p.m.