Learn R Programming

UScensus2010 (version 0.20.0)

nameTofips: County or MSA name to FIPS code(s).

Description

Takes the name of a county or msa and returns the associated fip(s) codes.

Usage

nameTofips(name, state, type = c("county", "msa"), statefips = FALSE)

Arguments

name

a character string, should be either a name of a county or msa.

state

a character string, can either be the full name (e.g. "oregon"), the abbreviation (e.g. "or"), or the FIPS code (e.g. "41")-- note that if you are using the FIPS code you have to change statefips to TRUE.

type

a character string, should be either "county" or "msa"

statefips

logical, by default statefips=FALSE, change to TRUE when providing state with a FIPS code.

Value

Returns a character string.

References

Zack W. Almquist (2010). US Census Spatial and Demographic Data in R: The UScensus2000 Suite of Packages. Journal of Statistical Software, 37(6), 1-31. https://www.jstatsoft.org/v37/i06/.

Census 2010 Summary File 1 [name of state1 or United States]/prepared by the U.S. Census Bureau, 2011. https://www.census.gov/prod/cen2000/doc/sf1.pdf

Examples

Run this code
# NOT RUN {
## SF MSA FIPS Code
nameTofips("san francisco","ca","msa")

## Orange County FIPS
nameTofips("orange","ca","county")
# }

Run the code above in your browser using DataLab