How do I call the `function` function?

前端 未结 3 1558
后悔当初
后悔当初 2020-12-15 04:07

I am trying to call the function `function` to define a function in R code.

As we all know™️, `function`is a .Primitive that’s

3条回答
  •  爱一瞬间的悲伤
    2020-12-15 04:32

    This is because function is a special primitive:

    typeof(`function`)
    #> [1] "special"
    

    The arguments are not evaluated, so you have actually passed quote(formals(mean)) instead of the value of formals(mean). I don't think there's a way of calling function directly without evaluation tricks, except with an empty formals list which is just NULL.

提交回复
热议问题