get.fips.county: Get County FIPS from block or block group FIPS

View source: R/get.fips.county.R

get.fips.countyR Documentation

Get County FIPS from block or block group FIPS

Description

Extract partial FIPS code from longer FIPS code

Usage

get.fips.county(fips, clean = TRUE)

Arguments

fips

Vector of one or more elements, character class, 5, 11, 12 or 15 characters long after missing leading zeroes inferred (county, tract, block group or block), required.

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

Details

Each fips passed to the function is a FIPS code (see http://www.census.gov/geo/reference/ansi.html.) It does not check to see if the codes are valid other than counting how many characters each has if clean=FALSE.

Value

Returns a vector of one or more character elements, same lengths as fips NA where input cannot be converted to county/tract/block group/block length code, as with state fips as input.

See Also

clean.fips()

Examples

samplefips <- c("011030001003", "011030001003001", 02610, 11030001003001, 35, 1,
 NA, 'invalidtext', '02')
get.fips.county(samplefips)

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