geofips: DRAFT - IN PROGRESS - Convert between FIPS / ANSI codes and...

View source: R/geofips.R

geofipsR Documentation

DRAFT - IN PROGRESS - Convert between FIPS / ANSI codes and Names of U.S. Geographies

Description

Tries to interpret vector of one or more FIPS codes and/or names of geographies, and convert between them.

Usage

geofips(x, to, clean = TRUE)

Arguments

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 clean.fips() for details.

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

Value

Returns vector of same length as x, containing fips as character elements with any leading zeroes, and/or names of geographies.

See Also

get.fips.st() and related functions noted there, clean.fips(), get.state.info()

Examples

   geofips(c('NY', 'Alabama', 1, 14, 'Montgomery County, Maryland',
    '01121', 1121, '060690006002', 60690006002, '011210118001025'))
   geofips(c('01121', 'Montgomery County, Maryland'), c('state', 'fips.st')

ejanalysis/ejanalysis documentation built on April 2, 2024, 10:12 a.m.