Cleaning Data Patterns

I still clean data from time to time, and I find myself writing patterns that looks like raw_data %>% mutate ( smoking = case_match ( str_to_lower (smoking), "y" ~ "Y" , "n" ~ "N" , .default = "N" ), hypertension = case_match ( str_to_lower (hypertension), "y" ~ "Y" , "n" ~ "N" , .default = "N" ), diabetes = case_match ( str_to_lower (diabetes), "y" ~ "Y" , "n" ~ "N" , .default = "N" ) ) # A…