ggplot2
makeMap
takes in two sources of data that refer to geographical
regions and merges them together. Depending on the arguments passed,
it returns this merged data or a ggplot object constructed with the data.
makeMap(
data = NULL,
map = NULL,
key = c(key.data, key.map),
key.data,
key.map,
tr.data = identity,
tr.map = identity,
plot = c("borders", "frame", "none")
)
A dataframe with regions as cases
An object that can be fortified to a dataframe (ex: a dataframe itself, or a SpatialPolygonsDataFrame)
The combination of key.data
and key.map
The column name in the data
that holds the
unique names of each region
The column name in the map
that holds the
unique names of each region
A function of the transformation to be performed to
the key.data
column
A function of the transformation to be performed to
the key.map
column
The plot desired for the output. plot
= "none"
returns the merged data that is the result of merging the data
and map
together; plot
="frame" returns an empty
(unplottable) ggplot object; plot
= "border" (the default)
returns a ggplot object with one geom_polygon layer that shows the
borders of the regions.