# Coerce all columns to string:
iris <- iris %>%
tibble::as_tibble() %>%
dplyr::mutate(across(everything(), as.character))
# The function will operate on all
# numeric-like columns but not on `"Species"`:
iris %>%
decimal_places_df()
# Operate on some select columns only
# (from among the numeric-like columns):
iris %>%
decimal_places_df(cols = starts_with("Sepal"))
Run the code above in your browser using DataLab