Simpler to demonstrate:
do.on( find.funs(), environment( get( .)))
# same as:
lapply( find.funs(), function( x) environment( get( x)))
do.on
evaluates expr
for all elements of x
. The expression should involve the symbol .
, and will be cast into a function which has an argument .
and knows about any dotdotdot arguments passed to do.on
(and objects in the function that calls do.on
). If x
is atomic (e.g. character or numeric, but not list) and lacks names, it will be given names via named
. With do.on
, you are calling sapply
, so the result is simplified if possible, unless simplify=FALSE
(or simplify="array"
, for which see sapply
). With FOR
, you are calling lapply
, so no simplication is tried; this is often more useful for programming.