R/US_stateConversion.R
US_stateConversion.RdConverts a vector of US state names or codes from one system to
another returning NA where no match is found.
US_stateCodeToName(stateCode = NULL)
US_stateCodeToFIPS(stateCode = NULL)
US_stateFIPSToName(stateFIPS = NULL)
US_stateFIPSToCode(stateFIPS = NULL)
US_stateNameToCode(stateName = NULL)
US_stateNameToFIPS(stateName = NULL)A vector of US state names or codes.
library(MazamaSpatialUtils)
US_stateNameToCode("Washington")
#> [1] "WA"
US_stateNameToFIPS("Washington")
#> [1] "53"
postalCodes <- sample(US_stateCodes$stateCode, 30)
data.frame(
name = US_stateCodeToName(postalCodes),
code = postalCodes,
FIPS = US_stateCodeToFIPS(postalCodes)
)
#> name code FIPS
#> 1 Texas TX 48
#> 2 Michigan MI 26
#> 3 Hawaii HI 15
#> 4 Oklahoma OK 40
#> 5 Oregon OR 41
#> 6 Vermont VT 50
#> 7 New Jersey NJ 34
#> 8 Arkansas AR 05
#> 9 Virginia VA 51
#> 10 District of Columbia DC 11
#> 11 California CA 06
#> 12 South Carolina SC 45
#> 13 Minnesota MN 27
#> 14 Indiana IN 18
#> 15 Idaho ID 16
#> 16 Alaska AK 02
#> 17 Rhode Island RI 44
#> 18 Maryland MD 24
#> 19 North Carolina NC 37
#> 20 Colorado CO 08
#> 21 Utah UT 49
#> 22 New Mexico NM 35
#> 23 Wyoming WY 56
#> 24 Iowa IA 19
#> 25 Washington WA 53
#> 26 Arizona AZ 04
#> 27 Mississippi MS 28
#> 28 Massachusetts MA 25
#> 29 Georgia GA 13
#> 30 Connecticut CT 09