Peter Dalgaard wrote:

<snip>
> Notice also that in
>
> lapply(1:4,function(i) F(i))
>
> it would be pretty weird if lapply would behave differently depending
> on the name of formal arguments of the function, i.e. if
>
> lapply(1:4,function(meep) F(meep))
>
> gave a different result. And f() depends on looking for a variable i
> outside of the function.

here's one example:

d = data.frame(a=1, b=2)

lapply(3, function(a) subset(d, select=a))
lapply(3, function(b) subset(d, select=b))
lapply(3, function(c) subset(d, select=c))

vQ

______________________________________________
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