zip.plot: Plot US ZIP codes, including locations of letter recipients.

View source: R/zip.plot.R

zip.plotR Documentation

Plot US ZIP codes, including locations of letter recipients.

Description

Using United States ZIP codes, plots on a map the location of letter recipients. State or county boundaries may be displayed.

Usage

zip.plot(data, zip.file = system.file("extdata", "zips.tab", package = 
"muRL"), map.type = "state", cex = 1, col = "black", pch = 20, 
jitter.factor = NULL, ...)

Arguments

data

a dataframe with ZIP codes in a column named 'zip', such as the output of read.murl.

zip.file

a character string naming a .tab file with the columns for the latitude and longitude of ZIP codes, such as 'zips.tab' provided in the murl package (the default).

map.type

the type of map for map() from the maps library to create. See Details for more.

cex

a numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. Accepts, for example, a vector of values which are recycled.

col

a specification for the plotting color.

pch

the plotting character for map() from the maps library to use.

jitter.factor

a numeric specifying by how much points should be jittered before plotting. See Details below for more.

...

other arguments to pass to map() from the maps library. See Details below for more.

Details

map.type can be any valid map from the maps package. For plotting the location of United States ZIP codes, usa, state, or county should be used.

See help(par) for more details on cex, col, and pch.

See help(jitter) for more details on jitter.factor. zip.plot jitters latitude and longitude separately using the same factor.

To plot only a region within the selected map.type, include the map argument region = . For example, zip.plot(..., region = ``Maryland'') would plot only the recipients with ZIP codes in the US state of Maryland.

Note

zip.plot calls the map function in the maps package. The map function places an object called stateMapEnv in the user's workspace.

Author(s)

Ryan T. Moore rtm@american.edu and Andrew Reeves reeves@wustl.edu

See Also

read.murl, zips

Examples

## Call murl object of sample addresses
data(murljobs)
zip.plot(murljobs)

## Read .csv to murl object
murljobs <- read.murl(system.file("extdata", "murljobs.csv", package = "muRL"))
## Specify US state to map
zip.plot(murljobs, map.type = "state", region = "maryland")

muRL documentation built on Aug. 22, 2023, 9:11 a.m.