fips: FIPS code conversion function.

Description Usage Arguments Details Value Author(s) Examples

View source: R/fips.R

Description

fips converts U.S. state names and abbreviations to and from FIPS codes.

Usage

1
fips(x, to = "FIPS")

Arguments

x

A vector, data frame or matrix of character strings or numeric FIPS codes. Character input can be the two-letter postal abbreviation, the full name of a state, or a FIPS code in character format. The string is case insensitive. FIPS codes are the only numeric input supported.

to

A character string of output type: "FIPS" will return a numeric fips code. "Abbreviation" will return a two letter state abbreviation. "Name" will return the full state name with spaces. The default output is a numeric FIPS code.

Details

The Federal Information Processing Standard (FIPS) provides a set of standard numeric codes for refering to U.S. states. This function converts between FIPS codes, state two letter abbreviations, and full state names.

Value

The output type specified by the "to" argument. If no match can be made, the program returns NA.

Author(s)

Jonathan Lisic, jlisic@gmail.com

Examples

1
2
3
4
fips("ia")
fips('northcarolina', to='Abbreviation')
fips('North Carolina')
fips(44,to='Name')

Example output

[1] 19
[1] "NC"
[1] 37
[1] "Rhode Island"

cdlTools documentation built on July 2, 2020, 1:51 a.m.

Related to fips in cdlTools...