Skip to contents

Downloads and processes school directory data from the Wisconsin Department of Public Instruction via their GIS Open Data portal. This includes all public schools and districts with addresses, grade ranges, and school type information.

Usage

fetch_directory(end_year = NULL, tidy = TRUE, use_cache = TRUE)

Arguments

end_year

Currently unused. The directory data represents the current school year and is updated regularly by DPI. Included for API consistency with other fetch functions.

tidy

If TRUE (default), returns data in a standardized format with consistent column names. If FALSE, returns raw column names from DPI.

use_cache

If TRUE (default), uses locally cached data when available. Set to FALSE to force re-download from DPI.

Value

A tibble with school directory data. Tidy columns include:

  • state_district_id: 4-digit district identifier (SDID)

  • state_school_id: 4-digit school code (SCH_CODE)

  • unique_id: 9-digit DPI unique join code (district + school)

  • district_name: District name

  • school_name: School name

  • entity_type: School type (e.g., "Elementary School", "High School")

  • agency_type: Agency type (e.g., "Public school", "Non District Charter Schools")

  • grades_served: Grade range (e.g., "K4-08", "09-12")

  • address: Physical street address

  • city: City

  • state: State (always "WI")

  • zip: ZIP code

  • phone: Phone number (NA – not available from GIS source)

  • county_name: County of physical location

  • is_charter: Logical, TRUE if charter school

  • is_virtual: Logical, TRUE if virtual school

  • website: School website URL

  • locale: Locale classification (e.g., "City - Small", "Rural - Remote")

  • cesa: CESA (Cooperative Educational Service Agency) region number

  • superintendent_name: NA_character_ (not available from GIS source)

  • superintendent_email: NA_character_ (not available from GIS source)

  • principal_name: NA_character_ (not available from GIS source)

  • principal_email: NA_character_ (not available from GIS source)

  • nces_code: 12-digit NCES code (for cross-reference only)

  • latitude: Latitude of school location

  • longitude: Longitude of school location

Details

The directory data is downloaded from the Wisconsin DPI's GIS Open Data portal, which publishes point location data for all public schools in Wisconsin. The data includes approximately 2,300 schools and is updated periodically by DPI.

Note: superintendent, principal, phone, and email fields are set to NA because the GIS data source does not include contact information. Contact data is available through DPI's School Directory Public Portal at https://apps6.dpi.wi.gov/SchDirPublic/home but is not programmatically accessible.

Examples

if (FALSE) { # \dontrun{
# Get school directory data
dir_data <- fetch_directory()

# Get raw format (original DPI column names)
dir_raw <- fetch_directory(tidy = FALSE)

# Force fresh download (ignore cache)
dir_fresh <- fetch_directory(use_cache = FALSE)

# Filter to charter schools only
library(dplyr)
charters <- dir_data |>
  filter(is_charter)

# Find all schools in Madison Metropolitan district
madison_schools <- dir_data |>
  filter(district_name == "Madison Metropolitan")
} # }