Get name of function in R

前端 未结 2 1409
隐瞒了意图╮
隐瞒了意图╮ 2021-01-24 07:53

I have a function f:

f=function(){}

and a variable

var=f

I would like to know how to get the name of the fun

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-24 08:31

    var=f assignes function(){} to var. It only knows that it is a function and 'forgets' about variable name. This code:

    f <- function(){}
    var <- f
    

    has the same effect as this:

    var <- function(){}
    

提交回复
热议问题