ff_plot_census: Choropleth Map for Census Tracts

View source: R/visualizations.R

ff_plot_censusR Documentation

Choropleth Map for Census Tracts

Description

This function creates choropleth maps for census tract estimates.

Usage

ff_plot_census(
  data,
  col_census_name,
  col_estimate,
  title,
  reverse_colors = F,
  legend_suffix = NULL,
  legend_prefix = NULL
)

Arguments

data

Name of the dataframe with data and shapefiles

col_census_name

column name as a string of the column with the census tract names

col_estimate

column name as a string of the column with the estimate we want to plot

title

title of plot

reverse

reverse the mapping of the colors to numbers (by default dark colors represent high numbers)

Value

choropleth map of census tracts and estimate

Examples

df <- tidycensus::get_acs(state = "NC",
                          county = "Forsyth",
                          geography = "tract",
                          variables = "S2301_C03_001",
                          geometry = TRUE) %>%
      dplyr::mutate(NAME = stringr::str_replace(", Forsyth County, North Carolina", ""))

ff_plot_census(df, "NAME", "estimate", "Employment Rate", T, NULL, "%")


forsythfuture/FFtools documentation built on April 5, 2022, 10:02 p.m.