Certainly a very basic question but I do not have the answer:
I have a vector of function:
func1 <- function(u) u
func2 <- function(u) NA
func3 <- function(u) 1
funcs = c(func1, func2, func3)
I loop over every function using sapply
, and I want to find a function command
that retrieves the name of the function:
res=sapply(funcs, function(f){
command(f)
})
So that res
is then:
c("func1","func2","func3")