I should clarify that the original *problem* wasn't a case of environment()<- but a proposed solution was. As the proposer wrote, "However, this can lead to headaches downstream".
We agree that it is very important and useful to understand environments in R. I once set out to construct a formal model of environments in S and R and how lookup works. I lost track of all the functions I had to consider and gave up. On Thu, 7 May 2020 at 16:50, Mark Leeds <marklee...@gmail.com> wrote: > > Richard: I may have implied that one should "mess with environments" by > saying that I agree with Abby. If so, my apologies because that's not what I > meant. > I only meant understanding. > > > > On Thu, May 7, 2020 at 12:47 AM Mark Leeds <marklee...@gmail.com> wrote: >> >> Hi Richard: I didn't say it was and didn't mean to imply it. All I said is >> that it was an example of where "not understanding environments" can lead >> to errors that won't be understood by the person experiencing them. It just >> so happens that the use of "environment(f) <- " can lead to a solution but >> there >> are other solutions and it was not my intention to talk about the various >> solutions. Only that it can be helpful if one understands the notion of >> environments in R. >> >> >> >> >> >> >> >> >> On Thu, May 7, 2020 at 12:42 AM Richard O'Keefe <rao...@gmail.com> wrote: >>> >>> That example is NOT an example of "messing around with environments." >>> >>> On Thu, 7 May 2020 at 15:36, Mark Leeds <marklee...@gmail.com> wrote: >>> > >>> > Hi Abby: I agree with you because below is a perfect example of where not >>> > understanding environments causes a somewhat >>> > mysterious problem. Chuck Berry explains it in a follow up email. >>> > >>> > https://r.789695.n4.nabble.com/issues-with-environment-handling-in-model-frame-td4762855.html >>> > >>> > >>> > On Wed, May 6, 2020 at 11:28 PM Abby Spurdle <spurdl...@gmail.com> wrote: >>> >> >>> >> > If you want to mess around with the environment of a >>> >> > function, then you need to understand this stuff, but you probably >>> >> > shouldn't do that. >>> >> >>> >> What exactly do you mean? >>> >> >>> >> Are you implying that a user should not use environments? >>> >> In which case, I would disagree. >>> >> >>> >> ______________________________________________ >>> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> >> https://stat.ethz.ch/mailman/listinfo/r-help >>> >> PLEASE do read the posting guide >>> >> http://www.R-project.org/posting-guide.html >>> >> and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.