Before someone marks this question as duplicate, I have already seen this one and it does not solve my question. If I try
mtcars %>% mutate(new = rowMeans(select(.,c(1,7)), na.rm = TRUE))
it works nicely, but if I do the same with pmax
instead of rowMeans
:
mtcars %>% mutate(new = pmax(select(.,c(1,7)), na.rm = TRUE))
I get
Error: Column `new` is of unsupported class data.frame
Why? In this example, I can get the output with
mtcars %>% mutate(new = pmax(mpg,qsec,carb,na.rm = TRUE))
but I try to use select
since I need for my real data either some select helper
or variables determined by column position (like 1,7
in the example), and otherwise I also get errors.
As suggested in an answer in the linked question I also tried to use do.call
obtaining an error too.
Thank you!