[R] Self-starting nls functions

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sun Apr 29 13:36:08 CEST 2001


On Sun, 29 Apr 2001, Philippe Grosjean wrote:

> Hello,
>
> I am doing several self-starting growth functions for using with nls(). When
> I list the self-starting functions included in nls library, for instance,
> SSlogis, there is:
>
> > SSlogis
> function (input, Asym, xmid, scal)
> ...
> <environment: 03476D20>
> attr(,"class")
> [1] "selfStart"
>
> What is this <environment: 03476D20> instruction?

All functions in R have an environment.  It is only printed if it is not
the global environment, aka the user workspace.  The environment is use in
lexical scoping: see the FAQ.  Normally functions in packages are not
lexically scoped (their environment is made the global environment), so you
rarely see this.  Note that in this case it is the attribute function that
has a non-default environment, not SSlogis itself, and you can find out
what is in it (and hence what it is) by

ls(envir = environment(attr(SSlogis, "initial")))

I rather suspect this is a mistake and the environment should
have been reset to the global environment as with the function itself.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list