geofips | R Documentation |
Tries to interpret vector of one or more FIPS codes and/or names of geographies, and convert between them.
geofips(x, to, clean = TRUE)
x |
Required vector of one or more numeric or character FIPS and/or names of geographic locations.
Allowed types are State, County (or equivalent), tract, block group, and block.
Names for tracts, blockgroups, and blocks are not provided or interpreted.
FIPS codes here are all the relevant digits starting with the 2-character state FIPS,
so county fips must be 4-5 digits or characters for example (leading zeroes are inferred where
possible and included in outputs). See |
to |
Optional. When the to parameter is not specified, then x that appear to be fips are converted to name, and x that appear to be names are converted to fips. Can specify vector of types of geographies (state, etc.) to convert fips to. This is useful to find County or State names for a list of tract fips, for example. The to parameter can be fips (which converts names to any appropriate type of fips), name (which converts to appropriate type of name based on fips length), specific type of name including state, county, tract, bg (or blockgroup), or block, or specific type of fips, including fips.st, fips.county, fips.tract, fips.bg, fips.block. Names for tracts, blockgroups, and blocks are not provided or interpreted. Variations also work such as plural and case-insensitive. |
clean |
Does not use clean.fips() if FALSE, which helps if the countiesall or other list is not yet updated, for example and lacks some new FIPS code |
Returns vector of same length as x, containing fips as character elements with any leading zeroes, and/or names of geographies.
get.fips.st()
and related functions noted there, clean.fips()
, get.state.info()
geofips(c('NY', 'Alabama', 1, 14, 'Montgomery County, Maryland',
'01121', 1121, '060690006002', 60690006002, '011210118001025'))
geofips(c('01121', 'Montgomery County, Maryland'), c('state', 'fips.st')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.