readCensus: Read US census

Description Usage Arguments Value Author(s) See Also Examples

Description

Read US census demographic profile data. The raw data can be downloaded in Shapefile format from http://www2.census.gov/geo/tiger/TIGER2010DP1/County_2010Census_DP1.zip to be used with this function.

Usage

1
readCensus(dsn="",layer="County_2010Census_DP1",state,fips,codes)

Arguments

dsn

The data source name, usually a path pointing to the folder the county shapefile is in. Defaults to current directory.

layer

Layer name, usually the filename without the extension. Defaults to the 2010 Census data by county (County_2010_Census_DP1).

state

A character vector specifying which states to extract. If not specified, defaults to all states.

fips

A data.frame object with 5-digit FIPS codes as row numbers and two columns (state,county) with names of the state and county matching the FIPS code. A complete object is included in this package, see the fipslookup dataset.

codes

A lookup table for demographic profile data element to its full name. One such lookup table for age and sex demographic groups is provided with this package, see the dplookup dataset.

Value

A SpatialPolygonsDataFrame. The data slot contains renamed columns of all the age and sex groups along with a 5 digit state+county FIPS column. This format is compatible for use with the getSMR function from the diseasemapping package.

Author(s)

Jonathan Lee jonathan@utstat.utoronto.ca

See Also

dplookup

Examples

1
2
3
4
5
6
7
data(dplookup)
data(fipslookup)

## Not run: 
usPop <- readCensus(dsn="/",layer="County_2010Census_DP1",state="Kentucky",
                     fips=fipslookup,codes=dplookup)
## End(Not run)

UScancer documentation built on May 1, 2019, 9:21 p.m.