R/fips_borough.R

Defines functions boro_mutate

Documented in boro_mutate

#' Takes a fips county code and turns it into a borough name
#'
#' @param df dataframe containing fips column
#' @param col fips column
#' @export




boro_mutate <- function(df, fips_col){

  col = enquo(fips_col)

  return(
    df %>%
      dplyr::mutate(borough = dplyr::case_when(
             !!col == '5' ~ 'Bronx',
             !!col == '47' ~ 'Brooklyn',
             !!col == '81' ~ 'Queens',
             !!col == '61' ~ 'Manhattan'
      )

      ))
}
tfarley10/faRley documentation built on April 7, 2020, 11:47 a.m.