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 statefips to TRUE. This variable is insensitive to case.
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 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.
Warning
You must have the packages UScensus2000blkgrp and UScensus2000blk installed to use levels "blkgrp" and "blk" respectively.
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/.
## 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)