79413405

Date: 2025-02-05 00:58:21
Score: 1
Natty:
Report link

rowwise() + c_across() is generally super slow. You could use pmap() in combination with across() for a faster option that is still tidyverse friendly:

library(tidyverse)
mtcars %>% 
  mutate(maxval = pmap(across(one_of(c("drat", "wt"))), ~max(c(...))))

Though probably still slower than the invoke() / exec() based approach by @akrun...

Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @akrun
  • Low reputation (0.5):
Posted by: Bryan Shalloway