7
我想在R中編寫一個包裝函數。我應該帶一個函數及其參數。做一些事情,然後用提供的參數調用函數。如何通過R中的包裝函數傳遞函數及其參數?類似於python中的* args和* kwargs
我知道該怎麼做,在Python,但我搜索在R. 了一個Python實現我會寫:
def wrapper(func, *args, **kwargs):
#do something here
return func(*args, **kwargs)