fips {cdlTools}R Documentation

FIPS code conversion function.

Description

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

Usage

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 referring to U.S. states. This function converts between FIPS codes, state two letter abbreviations, and full state names.

County abbreviations are supported for FIPS to name conversion only.

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

fips("ia")
fips('northcarolina', to='Abbreviation')
fips('North Carolina')
fips(44,to='Name')
fips("01001",to='Name')

[Package cdlTools version 1.13 Index]