Learn R Programming

muRL (version 0.1-13)

zip.plot: 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.

Author

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

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.

See Also

read.murl, zips

Examples

Run this code
## 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")

Run the code above in your browser using DataLab