0

I am new to r and just trying the row wise function. But it seems did not really give me what I wanted.

df1 <- data.frame(Y1 = c(1, 2, 3, 4, 5),
              Y2 = c(1, 3, 4, 2, 6),
              Y3 = c(4, 1, 0, 0, 1))

df0 = df1 %>% rowwise() %>% mutate(Maximum = max(Y1:Y3)) %>% select(Y1:Y3,Maximum)

And the output given is as follows: enter image description here

which is just not right in terms of the maximum value over the rows.

Any helps would be appreciated.

Vin
  • 19
  • 2

0 Answers0