FIPS - Read and clean FIPS column from a table, after inferring which col it is
Source:R/FIPS_FUNCTIONS.R
fips_from_table.Rd
Just read the codes in one column of a table obtained from something like read.csv, or excel, etc.
Arguments
- fips_table
data.frame or data.table of FIPS codes for counties, states, or tracts, for example, in a column whose name can be interpreted as FIPS (is one of the aliases like fips, countyfips, etc.) Aliases are: c("FIPS", "fips", "fips_code", "fipscode", "Fips", "statefips", "countyfips", "ST_FIPS", "st_fips", "ST_FIPS", "st_fips", "FIPS.ST", "FIPS.COUNTY", "FIPS.TRACT")
- addleadzeroes
whether to add leading zeroes where needed as for a State whose FIPS starts with "01"
- inshiny
used by server during shiny app
See also
fips_bgs_in_fips()
fips_lead_zero()
getblocksnearby_from_fips()
fips_from_table()
Examples
fips_from_table( data.frame(countyfips=0, FIPS=1, bgfips=2, other=3, fips=4))