View source: R/clean_facility_name.R
clean_facility_name | R Documentation |
A facility name cleaning function. Uses GitHub facility name cross-walk to find all possible name variations. Cleans federal and non-federal facilities in separate processes, in order to use "State" to merge or not. If no match is found in the crosswalk, both Facility.ID and Jurisdiction will equal NA in the resulting output.
clean_facility_name(dat, alt_name_xwalk = FALSE, debug = FALSE)
dat |
Scraped/historical data with columns Name and State, at the very least |
alt_name_xwalk |
Optional parameter provides an alternative facility name crosswalk |
debug |
Boolean whether to include additional columns geneated during the merging process |
This function assumes that if a faceility is federal, then vars "Facility" OR "State" OR "Jurisdiction" will contain the word federal (case-insensitive).
For non-federal entities, the data returned gets "Jurisdiction" from fac_spellings
For federal + immigration entities, the data returned gets "Jurisdiction" and "State" from fac_spellings
When there is not enough info to get a match, both "Jurisdiction" and "Facility.ID" will be returned as NA
data set with cleaned columns, "Name", "Facility.ID", and "Jurisdiction" from fac_spellings
clean_facility_name( tibble(Name = "BULLOCK CORRECTIONAL FACILITY", State = "Alabama", Jurisdiction = "state")) clean_facility_name( tibble(Name = "LEE USP", State = "Federal", Facility = "prison"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.