Skip to contents

Download shapefiles based on FIPS codes of States, Counties, Cities/CDPs, Tracts, or Blockgroups

Usage

shapes_from_fips(fips)

Arguments

fips

vector of one or more Census FIPS codes such as from name2fips()

Value

spatial data.frame with one row per fips (assuming any fips are valid)

Examples

 fipslist = list(
  statefips = name2fips(c('DE', 'RI')),
  countyfips = fips_counties_from_state_abbrev(c('DE')),
  cityfips = name2fips(c('chelsea,MA', 'st. john the baptist parish, LA')),
  tractfips = substr(blockgroupstats$bgfips[300:301], 1, 12),
  bgfips = blockgroupstats$bgfips[300:301]
  )
#>   query     fullname fips fipstype
#> 1    DE     Delaware   10    state
#> 2    RI Rhode Island   44    state
#> 
#> 
#> 
#> Exact match, or Cities/CDPs showing any multiple possible matches, etc. (excluding if no match):
#> 
#>   eparegion ST stfips     countyname countyfips    placename    fips      query
#> 1         1 MA     25 Suffolk County      25025 Chelsea city 2513205 chelsea,MA
#>   multiple
#> 1         
#> 
#> 
#>                             query                        fullname    fips
#> 1                      chelsea,MA                Chelsea city, MA 2513205
#> 2 st. john the baptist parish, LA St. John the Baptist Parish, LA   22095
#>   fipstype
#> 1     city
#> 2   county
#> 
#> 
  shp <- list()
  if (FALSE) { # \dontrun{
   for (i in seq_along(fipslist)) {
    shp[[i]] <- shapes_from_fips(fipslist[[i]])
    print(shp[[i]])
    # mapfast(shp[[i]])
   }
  } # }