R/county_to_office.R

Defines functions county_to_office

Documented in county_to_office

#' Takes a county (string or numeric) and gives the corresponding rows of 
#' ref_lookup_office
#' 
#' @param county string or numeric county_cd
#' 
#' @export
county_to_office <- function(county) {
    if (is.numeric(county)) county <- 
            ref_lookup_county$county[ref_lookup_county$county_cd == county]
    county <- tolower(county)
    if (county == "clark") county <- "clark "
    ref_lookup_office[which(!is.na(str_match(tolower(ref_lookup_office[, 4]),
                                             pattern = fixed(county)))), ]
}
pocdata/pocr documentation built on Jan. 5, 2022, 9:54 a.m.