On 08/01/12 04:38, Gabor Grothendieck wrote:

<SNIP>

These two variations without bquote and the third which just replaces
for with while all (that I had previously posted) do work:

# 1
junk<- vector("list",4)
for(i in 1:4) {
        junk[[i]]<- eval(substitute(function(x) { 42 + i * x }, list(i = i)))
}
junk
<SNIP>

Dang!  I had tried using "substitute" before trying "bquote", but hadn't
at that time figured out that I needed to "eval()" the result in order to
get a function rather than a call.  Twigged to the need to use "eval()"
while fiddling about with "bquote", and then never went back to
"substitute".

The fact that I don't really understand any of this stuff and am basically
groping around in the dark, hammering and hoping, doesn't make it
any easier! :-)

    cheers,

        Rolf

______________________________________________
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.

Reply via email to