R/getcountyfullnames.R

Defines functions getcountyfullnames

Documented in getcountyfullnames

#' getcountyfullnames
#'
#' @param fips Census FIPS code as 5 digits for county
#'
#' @return
#' @export
#'
getcountyfullnames <- function(fips) {
  # data(countyinfo, package = 'covidcountyshinyapp')
  if (missing(fips)) {
    fips <- countyinfo$FIPS.COUNTY
  }
  fullname <- countyinfo$fullname[match(fips, countyinfo$FIPS.COUNTY)]

  # statename <- countyinfo$statename[match(fips, countyinfo$FIPS.COUNTY)]
  #
  # some names are missing in the lookup in that countyinfo dataset - need to fix later
  #   fullname[is.na(fullname)] <- paste(  x$county[is.na(fullname)], ', ', statename[is.na(fullname)], sep = '')

  return(fullname)
}
ejanalysis/covidcountyshinyapp documentation built on Aug. 31, 2022, 7:46 a.m.