sr_plot_choropleth_tracts: Choropleth maps by census tract using leaflet

sr_plot_choropleth_tractsR Documentation

Choropleth maps by census tract using leaflet

Description

Leaflet plot showing census tracts within a district and a fill color for the tracts based on data included in the parameters.

Usage

sr_plot_choropleth_tracts(
  census_data_by_tract,
  tract_shapefile,
  school_location,
  tool_tip_labels
)

Arguments

census_data_by_tract

Data frame with data by census tract that we want to plot. Must contain a 'GEOID' column because this column is merged with the census tract shapefile (tract_shapefile). There should only be one row per GEOID.

tract_shapefile

Shapefiles for the same census tracts as census_data_by_tract. Can be imported with ⁠[sr_census_tracts_in_district()]⁠. Can also use ⁠[tigris::tracts()]⁠. Can also use

school_location

A data frame containing the latitude and longitude of the school/s. The columns for these two data points should be called 'latitude' and 'longitude'. This information can be retreived from CCD school directories, which can be imported with sr_ccd_directory().

tool_tip_labels

Tool tips to use, as HTML. Example, which only shows the census tract name: ⁠glue::glue("<strong>{census_data_by_tract$NAME}</strong> |> lapply(htmltools::HTML)⁠

Value

A leaflet choropleth map of census tracts.


shanejorr/schoolreportr documentation built on Aug. 7, 2023, 12:25 p.m.