Romain Lorrilliere wrote:
>
> try this:
>
> my_list <- NULL
>
> for (i in 1:n)
>       {for (j in (i+1):m)
>               {my_list <- c(my_list,list(i_create_a_matrix(i,j)))
>       }
> }
>
Why it does not work as expected in this case?

  my_list <- NULL

  for (i in 1:10)
    my_list <- c(my_list, function(x) x^i)

  f <- my_list[[2]]
  f(10)

[1] 1e+10

Alberto Monteiro

______________________________________________
[email protected] 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