Now.. i just tried around and this might be a bit strange way to do things..
createFunc<-function(v){ v_out<-NULL for(i in v){ v_out[[i]]<-substitute(function(){x},list(x=i)) } return(v_out) } > y<-createFunc(c("a","b")) > y $a function() { "a" } $b function() { "b" } > eval(y$a)() [1] "a" > eval(y$b)() [1] "b" Am 03.05.2012 um 12:31 schrieb Casper Ti. Vector: > As the title says, I want to apply a function (which itself returns > a function) to a list (or vector), and get a list (or vector) of > generated functions as the return value, but get unexpected result. > > Anyone with an idea about the reason of this phenomenon and a correct > way to implement the requirements? Thanks very much :) > > -- > Using GPG/PGP? Please get my current public key (ID: 0xAEF6A134, valid > from 2010 to 2013) from a key server. > > ______________________________________________ > 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. [[alternative HTML version deleted]] ______________________________________________ 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.