I have a data.frame that has 100 variables. I want to get the sum of three variables only using mutate (not summarise).
mutate
summarise
If there is NA in a
rowwise() is my go-to function. It's like group_by() but it treats each row as an individual group.
rowwise()
group_by()
df %>% rowwise() %>% mutate(Sum = sum(c(var1, var2, var3), na.rm = TRUE))