map_with_data: Join county or state level data to US map data
Description
Join county or state level data to US map data
Usage
map_with_data(data, values = "value", include = c(), na = NA)
Arguments
data
The data that should be joined to a US map. This
parameter should be a data frame consisting of two columns,
a fips code (2 characters for state, 5 characters for county)
and the value that should be associated with that region. The
columns of data _must_ be fips and the value of the
`values` parameter.
values
The name of the column that contains the values to be associated
with a given region. The default is "value".
include
The regions to include in the output data frame. If regions is
"states"/"state", the value can be either a state name, abbreviation or FIPS code.
For counties, the FIPS must be provided as there can be multiple counties with the
same name.
na
The value to be inserted for states or counties that don't have
a value in data. This value must be of the same type as the value
column of data.
Value
A data frame composed of the map data frame (from us_map) except
an extra column containing the values in data is included.
The result can be plotted using ggplot2. See us_map for more details.