This function allows you to create a map of any school district with its neighbors symbolized by a selected variable.
sd_neighbor_map(data_year = "2019", school_district = NULL,
map_var = "Student Poverty", legend= TRUE, type = "like")Four digit year of master data to pull in. Options include 2013- 2019. Defaults to 2019.
Seven digit NCESID of the school district. Default is NULL.
Variable by which to symbolize the map.
Student Poverty colors by student poverty rate
Total Revenue colors by state and local revenue per pupil
Local Revenue colors by local revenue per pupil
State Revenue colors by state revenue per pupil
Percent Nonwhite colors by percent nonwhite enrollment
Median Household Income colors by owner-occupied median household income
Median Property Value colors by median property value
FRL colors by free and reduced price lunch rate
Defaults to Student Poverty
If TRUE, legend is visible. Defaults to TRUE.
Indicate which types of neighbors to return. Defaults to "like", returning a map of neighbors of the same district type (unified to unified, elementary to elementary and secondary to secondary). To view all neighbors use "all". This becomes important for districts like Chicago which have upwards of 50 neighboring school districts, but only 1 type-like neighbor. Chicago is a unified district with 1 unified neighbor, 16 secondary neighbors, and 32 elementary neighbors.
An image of the map which can be written out with
tmap::tmap_save(map, '~/Documents/map.png')
# NOT RUN {
map <- sd_neighbor_map(data_year = "2019", school_district = "2901000", "Percent Nonwhite")
# }
Run the code above in your browser using DataLab