9

I want to write a wrapper function in R. I should take a function and its arguments. Do something, and then call the function with the supplied arguments.

I know how to do it in python, but I search for an implementation in R. In python I would write:

def wrapper(func, *args, **kwargs):
    #do something here
    return func(*args, **kwargs)
Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
Nico
  • 197
  • 2
  • 6

1 Answers1

12
wrapper <- function(func, ...) {
    func(...)
}
Michael Hoffman
  • 32,526
  • 7
  • 64
  • 86