R/subset_state.R

Defines functions subset_state

Documented in subset_state

#' @title Subset State
#'
#' @export


subset_state <- function(stateName) {
  # Load in data sests from noncensus
  data(zip_codes, package = "noncensus")
  
  # Get the state abbreviation
  stateAbbr <- currentState %>%
    openintro::state2abbr()
  
  # Only return over state of interest
  return(
    zip_codes %>% 
      subset(zip_codes$state %>% `==`(stateAbbr))
  )
}
ntyndall/pdata documentation built on May 3, 2019, 8:05 p.m.