[R] masked by GlobalEnv ???

Martin Maechler maechler at stat.math.ethz.ch
Sat May 12 17:05:24 CEST 2012


>>>>> R Michael Weylandt <michael.weylandt at gmail.com>
>>>>>     on Sat, 12 May 2012 09:20:06 -0500 writes:

    > The right response is not to use attach().  What's going
    > on is that you have objects by those names in your global
    > workspace and in the object you are attaching. Since
    > .GlobalEnv is always (?) first on the search path, you
    > won't be able to see those that you just added unless you
    > remove the ones in .GlobalEnv (which name lookup will find
    > first) Whether this is something you need to do something
    > about is up to you -- it depends which ones you want to
    > access.

    > Still, I'll repeat -- the right answer is don't use attach().

    > Michael

Thank you Michael.
Specifically, I would slightly change that to say
   "  only use  attach()  instead of  load() "
since the latter overwrites objects in .GlobalEnv,
I do recommend using the former in this case.

Martin Maechler
ETH Zurich and R core Team


    > On Sat, May 12, 2012 at 5:54 AM, Jhope
    > <jeanwaijang at gmail.com> wrote:
    >> Hi R Listers,
    >> 
    >> I am trying to upload a data file and I received this
    >> message. It seems that I am still able to make graphs and
    >> Aeventexhumed still works in the analysis. Can I ignore
    >> this message or do I need to do something about this?
    >> 
    >> Jean
    >> 
    >>> require(plyr)
    >> Loading required package: plyr
    >>> turtlehatch <- read.csv(file.choose())
    >>> attach(turtlehatch)
    >> The following object(s) are masked _by_ '.GlobalEnv':
    >> 
    >>    Aeventexhumed, DeadHatch, ExDate, Hatchlings,
    >> MaxHatch, Oldeggs, Quadrat,    QuadratEvent, ST0, ST1,
    >> ST2, ST3, ST4, Sector, Shells, TotalEggs
    >> 
    >> --
    >> View this message in context:
    >> http://r.789695.n4.nabble.com/masked-by-GlobalEnv-tp4628664.html
    >> Sent from the R help mailing list archive at Nabble.com.
    >> 
    >> ______________________________________________
    >> R-help at r-project.org mailing list
    >> 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 at r-project.org mailing list
    > 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.



More information about the R-help mailing list