Learn R Programming

blscrapeR (version 1.0.1)

bls_map_county: Cloropleth mapping of BLS data

Description

Return a ggplot object to render a cloropleth map with county outlines. The map files contain 2015 FIPS codes and can be used with any data set containing county and state FIPS codes. They can not be used with the leaflet package but the shape files can be downloaded from the Census website or with the tigris package. See the "Mapping BLS Data" vignette for this package.

Usage

bls_map_county(map_data, fill_rate = NULL, labtitle = NULL, stateName = NULL)

Arguments

map_data
Dataframe to be used as the map's measures. Usually a result of calls to the get_bls_county() or get_bls_state() functions, but other dataframes, which include FIPS codes may be used as well.
fill_rate
Column name from the dataframe that you want to use as a fill value, in quotes. NOTE: This argument is mandatory!
labtitle
The main title label for your map passed as a string. The default is no title.
stateName
Optional argument if you only want to map a single state or a group of selected staes. The argument accepts state full state names in quotes.

See Also

https://cran.r-project.org/package=tigris

Examples

Run this code
## Not run: 
# # Download the most current month unemployment statistics on a county level.
# df <- get_bls_county()
# 
# # Map the unemployment rate by county.
# bls_gg <- bls_map_county(map_data = df, fill_rate = "unemployed_rate", 
#                  labtitle = "Unemployment Rate")
# bls_gg
# 
# 
# # Map the unemployment rate for Florida and Alabama.
# 
# df <- get_bls_county(stateName = c("Florida", "Alabama"))
# 
# bls_gg <- bls_map_county(map_data=df, fill_rate = "unemployed_rate", 
# stateName = c("Florida", "Alabama"))
# 
# bls_gg
# ## End(Not run)


Run the code above in your browser using DataLab