Derek,

You need a list.

f1 <- function(x) sin(x)
f2 <- function(x) cos(x)
f.list <- list(f1, f2)
f.list[[1]](pi)
f.list[[2]](pi)
## Note the double '[[' indexing.

## You can dimension a list to allow multiple-index indexing.
dim(f.list) <- c(2,1)
f.list[[1,1]](pi)
Rich




On Sun, Apr 24, 2011 at 9:37 AM, derek <jan.kacaba@gmail.com> wrote:

> Thats not exactly what I hoped for. But for now it has to suffice. More
> transparent  syntax would be nicer.
>
> Exactly what I would like to do is:
>
> for (i in 1:9){
> f[i]<-function(x){
> a*x+b)
> }
> curve(f[i],  0,  8)
> sol[i]<-uniroot(f[i],c(0,  8))$root
> points(sol[i],0,pch=16,cex=1,col="red")
> }
>
> Perhaps is item for a wish list?
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/filling-array-with-functions-tp3468313p3471463.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
>  R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

