# NOT RUN {
df <- data.table(x = runif(6), y = runif(6), z = runif(6))
# Compute the mean of x, y, z in each row
df %>%
mutate_rowwise.(row_mean = mean(c(x, y, z)))
# Use c_across.() to more easily select many variables
df %>%
mutate_rowwise.(row_mean = mean(c_across.(x:z)))
# }
Run the code above in your browser using DataLab