Hi,

I can get from a string to a function with this name:

>f1 <- function(x){ mean(x) }

>do.call("f1",list{1:4})
>get("f1")
etc...

But how do I get from a function to its name?

>funcVec <- c(f1,median)

>funcVec
[[1]]
function(x){ mean(x) }
> str(funcVec)
List of 2
 $ :function (x)
  ..- attr(*, "source")= chr "function(x){ mean(x) }"
 $ :function (x, ...)
> deparse(funcVec[1])
[1] "list(function (x) " "{"                  "    mean(x)"
[4] "})"


thank you very much
ido

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to