iris %>% if_col_present(Species, ~ .x %>% dplyr::rename(new = Species)) %>%
colnames()
# in contrast to `purrr` absolute values are not interpreted as function names
iris %>% if_col_present(Species2, "Yes", "No")
Run the code above in your browser using DataLab