Description Usage Arguments Value Warning Author(s) References Examples
county
allows the user to pull out the polygon and metadata of one or more county(s) from a given state.
1 2 3 |
fips |
a character string, takes a string of three characters (i.e. a county FIPS code (e.g. "001"). |
name |
a character string, this must be the name of an actual county in the state (e.g. "Baker" county Oregon). This variable is insensitive to case. |
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 |
level |
a character string, takes in one of three values: "tract", "blk", or "blkgrp". This defines the geographic level of data for the county. |
statefips |
logical, by default |
sp.object |
|
proj |
CRS-class, takes a CRS object (e.g. CRS("+proj=utm +zone=10 +datum=NAD83") ); This is simply a wrapper for the |
An object of class SpatialPolygonsDataFrame
.
You must have the packages UScensus2010tract
, UScensus2010blkgrp
and UScensus2010blk
installed to use levels "tract", "blkgrp" and "blk" respectively.
Zack W. Almquist almquist@uci.edu
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/cen2010/doc/sf1.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
#### look at the counties of Oregon
data(countyfips)
countyfips[countyfips$statename=="oregon",]
### The county fips code is the last three characters
county.f<-"001"
county.n<-c("deschutes","crook county")
## Pull out these counties
c1<-county(fips=county.f,state="or",level="tract")
c2<-county(name=county.n,state="or",level="tract")
##Plot counties
oregon.counties<-countyfips[countyfips$statename=="oregon",]
col<-cbind(c("red","blue"),c("013","017"))
plot(c2,col=col[match(c2$county,col[,2]),1],border="gray")
title("Deschutes and Crook counties, OR 2000")
coord<-coordinates(c2)
text(coord[c(1,4),],oregon.counties$countyname[oregon.counties$countyname%in%county.n],cex=2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.