Skip to content
Prev 20076 / 63421 Next

Return function from function with minimal environment

On 4/4/06, Henrik Bengtsson <hb at maths.lth.se> wrote:
OK. I think the example changed throughout the discussion and
scale was not part of the latter examples.

At any rate the version with scale could be reduced to one line using evalq:

foo <- function(huge)
   evalq(function(x) { scale * x }, list(scale = mean(huge)), baseenv())