school_districts: Download a school district shapefile into R

View source: R/enumeration_units.R

school_districtsR Documentation

Download a school district shapefile into R

Description

From the US Census Bureau (see link for source): School Districts are single-purpose administrative units within which local officials provide public educational services for the area's residents. The Census Bureau obtains school district boundaries, names, local education agency codes, grade ranges, and school district levels biennially from state education officials. The Census Bureau collects this information for the primary purpose of providing the U.S. Department of Education with annual estimates of the number of children in poverty within each school district, county, and state. This information serves as the basis for the Department of Education to determine the annual allocation of Title I funding to states and school districts.

Usage

school_districts(state = NULL, type = "unified", cb = FALSE, year = NULL, ...)

Arguments

state

The two-digit FIPS code (string) of the state you want. Can also be state name or state abbreviation. When NULL and combined with cb = TRUE, a national dataset of school districts will be returned for years 2019 and later.

type

Specify whether you want to return a unified school district (the default, 'unified'), an elementary school district ('elementary'), or a secondary school district ('secondary'). Please note: elementary and secondary school districts do not exist in all states

cb

if TRUE, download a generalized (1:500k) school districts file. Defaults to FALSE (the most detailed TIGER/Line file)

year

the data year; defaults to 2022

...

arguments to be passed to internal function load_tiger, which is not exported. See Additional Arguments.

Details

The Census Bureau creates pseudo-unified school districts for areas in which unified school districts do not exist. Additionally, elementary and secondary school districts do not exist in all states. Please see the link for more information on how the Census Bureau creates the school district shapefiles.

Additional Arguments

Additional arguments that can be passed in ... are:

  • class Desired class of return object: "sf" (the default) or "sp". sp classes should be considered deprecated as of tigris version 2.0, but legacy support is still available.

  • progress_bar If set to FALSE, do not display download progress bar (helpful for R Markdown documents). Defaults to TRUE.

  • keep_zipped_shapefile If set to TRUE, do not delete zipped shapefile (stored in temporary directory or TIGRIS_CACHE_DIR depending on the configuration of global option "tigris_use_cache"). Defaults to FALSE.

  • refresh Whether to re-download cached shapefiles (TRUE or FALSE) . The default is either FALSE or the value of global option "tigris_refresh" if it is set. Specifying this argument will override the behavior set in "tigris_refresh" global option.

  • filter_by Geometry used to filter the output returned by the function. Can be an sf object, an object of class bbox, or a length-4 vector of format c(xmin, ymin, xmax, ymax) that can be converted to a bbox. Geometries that intersect the input to filter_by will be returned.

See Also

https://www2.census.gov/geo/pdfs/maps-data/data/tiger/tgrshp2020/TGRSHP2020_TechDoc.pdf

Other general area functions: block_groups(), blocks(), counties(), county_subdivisions(), places(), pumas(), states(), tracts(), zctas()

Examples

## Not run: 
library(tigris)
library(leaflet)

schools <- school_districts("Maine")

leaflet(schools) %>%
  addProviderTiles("CartoDB.Positron") %>%
  addPolygons(fillColor = "white",
              color = "black",
              weight = 0.5)

## End(Not run)

tigris documentation built on May 29, 2024, 2:20 a.m.