Re: [Rd] [R] unvectorized option for outer()

From: Duncan Murdoch <>
Date: Mon 31 Oct 2005 - 19:44:27 GMT

On 10/31/2005 2:33 PM, Gabor Grothendieck wrote:
> On 10/31/05, Tony Plate <> wrote:

>> I have to confess I don't really understand how environments work with
>> functions, so I don't know if this Vectorize() function will work in
>> general.  What is the appropriate environment for returned value of
>> Vectorize()?  Is this approach to creating a Vectorize() function on the

> I think the environments of the input and output functions should be
> the same which can be accomplished via:
> environment(FUNV) <- environment(FUN)

No, definitely not. For example, FUN may have been defined in an environment in which "eval" has been replaced, but if FUNV needs eval, it needs the original one.

At some point FUNV will call FUN. As long as that evaluation of FUN keeps its original environment things will be fine.

Duncan Murdoch mailing list Received on Tue Nov 01 06:54:01 2005

This archive was generated by hypermail 2.1.8 : Tue 01 Nov 2005 - 01:02:01 GMT