clean.fips | R Documentation |
Clean up US Census FIPS (add any missing leading zeroes)
clean.fips(fips)
fips |
Vector of numeric or character class, required. Can be state FIPs as number or character, for example. |
For information on FIPS codes, see http://www.census.gov/geo/reference/ansi.html,
and also see https://www.census.gov/geo/reference/geoidentifiers.html
If FIPS provided is 1-2 digits long assume it is a State.
If FIPS provided is 3 digits long, it is a mistake and return NA.
If FIPS provided is 4-5 digits, assume it is a County.
If FIPS provided is 6-9 digits, it is a mistake and return NA.
If FIPS provided is 10 digits long, assume it is a tract missing a leading zero on the state portion (should have 11 characters).
If FIPS provided is 11 digits long, assume it is a tract (correctly 11 characters), not simply a block group FIPS missing a leading zero (block group FIPS would correctly would have 12 characters).
If FIPS provided is 12 digits long, assume it is a block group (correctly 12 characters).
If FIPS provided is 13 digits long, it is a mistake and return NA.
If FIPS provided is 14 OR 15 digits long, assume it is a block.
Returns vector of FIPS (all characters from 2-digit State code onwards as appropriate) as character with leading zeroes
clean.fips()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.