maechler@stat.math.ethz.ch
2000-Jul-12 06:35 UTC
[Rd] buglet in fix() [was "function via source or fix"] (PR#602)
>>>>> "Erin" == Erin Hodgess <hodgess@uhddx01.dt.uh.edu> writes:Erin> Suppose I create a function, x.e, via the fix command: (ESS users ESS don't ever do this, but still ...) >> x.e <- fix(x.e) Erin> When I type in x.e, the function code appears, along Erin> with the name/number of the environment. Ok, in the above it was important that there's no *existing* object x.e beforehand. Note that the idea about fix() is that you only have to write fix(x.e) But your problem remains : > fix(newerf) Waiting for Emacs...Done --- I have options(editor = "emacsclient") > newerf function () { ## newer } <environment: 0x40862004> > environment(newerf) <environment: 0x40862004> > ls(env=environment(newerf)) [1] "subx" "x" > I.e. it got the environment of the function fix -- I think this is clearly a bug CC'ed to R-bugs Erin> However, if I create a function, y.e, and source it in, when Erin> I type in y.e, the function code only displays(no Erin> environment). Erin> Why is this, please? (It's not a bug....I just wondered). it *is* a bug, I think Erin> I am using R-1.1.0 for Windows. same for Unix Erin> Thanks! thank you for the report! Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <>< -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian D Ripley
2000-Jul-12 08:05 UTC
[Rd] buglet in fix() [was "function via source or fix"] (PR#602)
On Wed, 12 Jul 2000 maechler@stat.math.ethz.ch wrote:> >>>>> "Erin" == Erin Hodgess <hodgess@uhddx01.dt.uh.edu> writes: > > Erin> Suppose I create a function, x.e, via the fix command: > > (ESS users ESS don't ever do this, but still ...) > > >> x.e <- fix(x.e) > > Erin> When I type in x.e, the function code appears, along > Erin> with the name/number of the environment. > > Ok, in the above it was important that there's no *existing* object x.e > beforehand. > > Note that the idea about fix() is that you only have to write > > fix(x.e) > > But your problem remains : > > > fix(newerf) > Waiting for Emacs...Done --- I have options(editor = "emacsclient") > > newerf > function () > { > ## newer > } > <environment: 0x40862004> > > environment(newerf) > <environment: 0x40862004> > > ls(env=environment(newerf)) > [1] "subx" "x" > > > > I.e. it got the environment of the function fix -- I think this is clearly > a bug CC'ed to R-bugsAnd the fix is easy: just add environment(x) <- .GlobalEnv in that branch of the if. Now committed to the R-patched branch. -- Brian D. Ripley, ripley@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-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._