R: passing expression to an inner function

前端 未结 2 481
我寻月下人不归
我寻月下人不归 2021-01-07 22:35

Further delving into the mysteries of R evaluation...This is closely related to my previous question ( How to write an R function that evaluates an expression within a data-

2条回答
  •  爱一瞬间的悲伤
    2021-01-07 23:25

    You can use three dots to gather arguments and pass them to another function, is that what you mean?

    ftop=function(...) f(...)
    f=function(a,b) a[b]
    
    a=data.frame(b=10)
    
    ftop(a,"b")
    
    f(a,"b")
    

提交回复
热议问题