I have a similar question as this one, but a more special case.
Consider the following example code:
fun1 <- mean
fun2 <- max
fun3 <- median
Now I want to get the names of the functions assigned to the variables as charachter
s.
While I understand that this is not possible in general, the above case seems somewhat special:
l <- list(fun1 = fun1, fun2 = fun2, fun3 = fun3)
l
$fun1
function (x, ...)
UseMethod("mean")
<bytecode: 0x2793818>
<environment: namespace:base>
$fun2
function (..., na.rm = FALSE) .Primitive("max")
$fun3
function (x, na.rm = FALSE)
UseMethod("median")
<bytecode: 0x28382c8>
<environment: namespace:stats>
So the output of print(funX)
contains the name of the function assigned to funX
.
How can I extract this information into a character
vector?