read.geo | R Documentation |
Reads and merges geo files that have been obtained from the US Census Bureau FTP site for American Community Survey (ACS) data. It uses read.fwf() at least for older years.
read.geo(
mystates,
folder = getwd(),
end.year = acsdefaultendyearhere_func(),
silent = FALSE
)
mystates |
Character vector of one or more states/DC/PR, as 2-character state abbreviations. Default is all states/DC/PR. |
folder |
Optional path to where files are stored, defaults to getwd() |
end.year |
End year of 5-year data, like "2018" |
silent |
Default is FALSE. Whether to send progress info to standard output. |
Note that if this finds the geographic file in folder already, it will not download it again even if that file was corrupt.
Extracts just block group (SUMLEVEL=150) and tract (SUMLEVEL=140) geo information (not county info., since data files used in this package lack county info.)
The NAME field works on pc but mac can hit an error if trying to read the NAME field. Due to encoding? specifying encoding didn't help.
(name is very long and not essential)
Error in substring(x, first, last) :
invalid multibyte string at '
Format of files is here: ftp://ftp.census.gov/acs2012_5yr/summaryfile/ACS_2008-2012_SF_Tech_Doc.pdf
Returns a large data.frame of selected geographic information on
all block groups and tracts in the specified states/DC/PR, with just these fields:
"STUSAB", "SUMLEVEL", "LOGRECNO", "STATE", "COUNTY", "TRACT", "BLKGRP", "GEOID"
get.acs()
, download.geo()
## Not run:
geo <- read.geo( c("dc", "de") )
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.