如何通过R中的包装函数传递函数及其参数?类似于python中的*args和*kwargs

Nic*_*ico 7 python r argument-passing

我想在R中编写一个包装函数.我应该使用一个函数及其参数.执行某些操作,然后使用提供的参数调用该函数.

我知道如何在python中做到这一点,但我在R中搜索一个实现.在python中我会写:

def wrapper(func, *args, **kwargs):
    #do something here
    return func(*args, **kwargs)
Run Code Online (Sandbox Code Playgroud)

Mic*_*man 11

wrapper <- function(func, ...) {
    func(...)
}
Run Code Online (Sandbox Code Playgroud)