powered by
c_across() works inside of mutate_rowwise(). It uses tidyselect so you can easily select multiple variables.
c_across()
mutate_rowwise()
c_across(cols = everything())
Columns to transform.
df <- data.table(x = runif(6), y = runif(6), z = runif(6)) df %>% mutate_rowwise(row_mean = mean(c_across(x:z)))
Run the code above in your browser using DataLab