Skip to contents

Converts a district name to a lowercase, hyphenated slug suitable for URLs and entity linking. Strips common suffixes like "School District", "Public Schools", etc. When duplicate slugs exist, appends the district_id to disambiguate.

Usage

slugify_district(district_name, district_id = NULL)

Arguments

district_name

Character vector of district names

district_id

Optional character vector of district IDs for collision resolution. Must be the same length as district_name.

Value

Character vector of slugified district names

Examples

slugify_district("Denver Public Schools")
#> [1] "denver"
# "denver"
slugify_district("Colorado Springs School District 11")
#> [1] "colorado-springs"
# "colorado-springs"
slugify_district(c("Liberty", "Liberty"), c("1234", "5678"))
#> [1] "liberty-1234" "liberty-5678"
# c("liberty-1234", "liberty-5678")