# NOT RUN {
test_df <- data.table(
x = c(1,1,1),
y = c(2,2,2),
z = c("a", "a", "b"))
test_df %>%
mutate_across.(where(is.numeric), as.character)
test_df %>%
mutate_across.(c(x, y), ~ .x * 2)
test_df %>%
mutate_across.(everything(), as.character)
test_df %>%
mutate_across.(c(x, y), list(new = ~ .x * 2,
another = ~ .x + 7))
test_df %>%
mutate_across.(
.cols = c(x, y),
.fns = list(new = ~ .x * 2, another = ~ .x + 7),
.names = "{.col}_test_{.fn}"
)
# }
Run the code above in your browser using DataLab