I've been trying to create a list of function where function[[i]] should actually return the value of i.
trying: func <- vector("list",2) i <- 1 while (i <= 2) { func[[i]] <- function() { i } i <- i+1 } however only returned the last value of i for each function. Any help how to achieve the solution intended would be greatly appreciated. thanks in advance, andreas posch ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.