I had to write a function today like this
data1 %>%
summarise(
ab1 = fn(a1, b1),
ab2 = fn(a2, b2),
ab3 = fn(a3, b3)
)
# imagine if there are 100 of them
If fn
was a single argument function I could've done
data1 %>%
summarise(across(starts_with("a", fn)))
But unfortunately, my function needs two columns as inputs. Is there a way to do this without writing a new line for every set of arguments?
pmap
– Beet