city: Selects one or more CDP(s) from a given state

Description Usage Arguments Value Author(s) References Examples

Description

city allows the user to pull out the polygon and metadata of one or more CDPs for any given state by name.

Usage

1
2
3
city(name, state, statefips = FALSE, 

sp.object = NULL, proj = NULL )

Arguments

name

a character string, takes the value of a string or string vector and has to be the exact name or names of CDP(s). (If you are unsure of the exact name a quick way to find it is to load the library(UScensus2010cdp) and pull out the list of names for the state you are interested in (see example).Note: if statefips=TRUE then this must be a CDP fips code.

state

a character string, can either be the full name (e.g. "oregon"), the abbreviation (e.g. "or"), or the FIPS code (e.g. "41")– note that if you are using the FIPS code you have to change statefips to TRUE.

statefips

logical, by default statefips=FALSE, change to TRUE when providing state with a FIPS code.

sp.object

SpatialPolygonsDataFrame, default NULL, allows the user to provide an sp object in which to perform this operation; primarily for use with demographics.add.

proj

CRS-class, takes a CRS object (e.g. CRS("+proj=utm +zone=10 +datum=NAD83") ); This is simply a wrapper for the spTransform function in rgdal . WARNING requires rgdal package.

Value

An object of class SpatialPolygonsDataFrame.

Author(s)

Zack W. Almquist almquist@uci.edu

References

Zack W. Almquist (2010). US Census Spatial and Demographic Data in R: The UScensus2000 Suite of Packages. Journal of Statistical Software, 37(6), 1-31. http://www.jstatsoft.org/v37/i06/.

Census 2010 Summary File 1 [name of state1 or United States]/prepared by the U.S. Census Bureau, 2011.
http://www.census.gov/prod/cen2000/doc/sf1.pdf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
##Load oregon.cdp10 data 
data(oregon.cdp10)

##look at the list of oregon CDP names in alphabetic order
oregon.cdp10$name[order(oregon.cdp10$name)]

##grab the CDP of Portland, OR
portland<-city(name="portland",state="or")


##plot the polygon of Portland, OR
plot(portland)
title("Portland, OR")

## End(Not run)

UScensus2010 documentation built on May 2, 2019, 5:13 p.m.