Surprised I have never come across this issue before...
What is the correct way to do operations across columns with dplyr? I would like to get the rowwise operation that is calculated in #2. However, as operations become more complex and involve multiple columns this becomes impractical. What is the appropriate way to write a more concise syntax, along the lines of #1?
library(dplyr)
#1
data.frame(a = c(1:5, 6:10),
b = c(6:10, 1:5)) %>%
mutate(MAX_COLUMN = max(a, b))
#2
data.frame(a = c(1:5, 6:10),
b = c(6:10, 1:5)) %>%
mutate(MAX_COLUMN = ifelse(a > b, a, b))