round values of multiple columns in r dplyr code example
Example: round multiple columns in r
# load dplyr
library(dplyr)
# Round at first decimal with a mixed df
mydf %>% mutate(across(where(is.numeric), round, 1))
# The two solutions above do the same
mydf %>% mutate(across(where(is.numeric), ~round(., 1)))
mydf %>% mutate_if(is.numeric, round, 1)