1 Load packages 2 Motivation 3 Minimal example 4 See also 5 Reproducibility 1 Load packages library(tidyverse) # data wrangling 2 Motivation Sometimes is is neccessary to compute functions, such as mean values, rowwise, ie., summing the values for multiple variables (my_vars) for each observation. 3 Minimal example For the sake of simplicity, we’ll make use of the mtcars dataset. data(mtcars) my_vars <- c("mpg", "cyl", "hp") mtcars <- mtcars |> select(all_of(my_vars)) |> rowwise() |> mutate(mtcars_score = mean(c_across(all_of(my_vars)), …