R/countiesinstates.R

Defines functions countiesinstates

Documented in countiesinstates

#' countiesinstates
#' Returns all the counties found in the specified states
#' @param states Full capitalized state names like Maryland
#' @param allcounties from getcountyfullnames()
#'
#' @export
#'
countiesinstates <- function(states, allcounties) {
  # allcounties <- getcountyfullnames()
  # allstates <- sort(c(state.name, 'District of Columbia'))
  countylist <- allcounties[gsub('(^.*, )(*.)', '\\2', x = allcounties) %in% states]
  return(countylist)
}
ejanalysis/covidcountyshinyapp documentation built on Aug. 31, 2022, 7:46 a.m.