> Suppose I have
> f1 <- function(x) x
> f2 <- function(x) x^2
> funlist <- list(f1,f2)
> Then I would like to evaluate funlist such that when x is 10 I should > get a list with 10 and 100.


How about
sapply(funlist, function(x) x(10))
?

> A related question is that of anonymous functions: how to evaluate
> function(x)x^2 on x<-10 without assigning the function to a name?

(function(x) x^2)(10)


Hadley


______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to