There is also a convenient functional functional::Curry:
f <- function(a, b, c) {a + b + c}
f(1, 2, 3)
library(functional)
g <- Curry(f, a = a1, c = c1)
g(b=2)
g(2)
I think the important difference with @NPE's solution is that the definition gusing Currydoes not mention b. Thus, you may prefer this approach when the number of arguments in fbecomes large.
source
share