Brian Ripley wrote:

> Can I also suggest local()?  This does a similar thing in a perhaps
> more natural way.

Sorry, I'm not with you.  I'm slow, and as I said, I don't
really grok environments.

Let's look at a toy example.  Suppose I want to create a function foo:

        function(x){x^n}

and assign n the value of 4, say, in the environment of foo.

Duncan Murdoch's solution was to create a function make.foo:

        make.foo <- function() {
                n <- 4
                foo <- function(x){x^n}
                foo
        }

and then execute

        foo <- make.foo()

How would I go about accompishing the same (toy) task making use of the
local() function?

Thanks.

                        cheers,

                                Rolf

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to