[R] how to undo automatic loading of packages?

davidr at rhotrading.com davidr at rhotrading.com
Wed Jun 24 18:30:28 CEST 2009


I removed all of the objects that were from the examples I tried, saved,
and quit.
R starts up cleanly now. Yeah!

That was annoying behavior, and I would recommend that the authors
change it, please.

Thank you for your to-the-point advice, Professor Ripley!
-- David
ps - Sorry for the lengthy disclaimer appended by my company - sigh.

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Sent: Wednesday, June 24, 2009 11:12 AM
To: David Reiner <davidr at rhotrading.com>
Cc: R-help at r-project.org
Subject: Re: [R] how to undo automatic loading of packages?

That was unintentional: the mail server crashed and apparently sent 
the just-started reply.

It is nothing to do with 'Autoloads'.  What is most likely if that you 
have saved a reference to a namespace such as 'distrMod' in your 
.RData file.  If that it is the case, when .RData is loaded it will 
load the namespace, and any namespaces it imports (and so on 
recursively).

Once distrMod's namespace is loaded, it can attach other packages, and 
indeed it does:

> loadNamespace("distrMod")
... lots of messages from those prolix authors ....
> search()
  [1] ".GlobalEnv"                 "package:RandVar"
  [3] "package:distrEx"            "package:actuar"
  [5] "package:evd"                "package:distr"
  [7] "package:SweaveListingUtils" "package:sfsmisc"
  [9] "package:startupmsg"         "package:stats"
[11] "package:graphics"           "package:grDevices"
[13] "package:utils"              "package:datasets"
[15] "package:methods"            "Autoloads"
[17] "package:base"

The only fix is to locate the object you saved with the reference to 
distrMod and delete it.  The only hint I can offer is that it is 
likely to be a function with namespace:distrMod as its environment.

Note that it is not regarded as good form for loading a namepace to 
attach a package, and should not be necessary.


On Wed, 24 Jun 2009, Prof Brian Ripley wrote:

> On Wed, 24 Jun 2009, davidr at rhotrading.com wrote:
>
>> I wanted to try out package distrMod, so I did
>> 
>>> install.packages('distrMod')
>>> library(distrMod)
>> 
>> and played around, saved and quit.
>> 
>> Now whenever I start up in this directory, I get distr and lots of
other
>> stuff loaded and lots of messages.
>> 
>> How do I keep it from automatically loading, other than starting over
in
>> another directory?
>> I read ?Startup, but I couldn't suss out where the autoloading was
>> occurring.
>> It probably has something to do with the "Autoloads" that shows up in
my
>> search list, but
>> I don't know how to get it out.
>> If I start up in another directory, this behavior is avoided, so I
don't
>> think it's in
>> any site files. In this session's R.home(), I have
>> $ cat .Rprofile
>> options(stringsAsFactors = FALSE)
>> so it's not in there.
>> 
>>> search()
>> [1] ".GlobalEnv"                 "package:grDevices"
>> "package:datasets"           "package:RandVar"
>> [5] "package:distrEx"            "package:actuar"
>> "package:evd"                "package:distr"
>> [9] "package:SweaveListingUtils" "package:sfsmisc"
>> "package:utils"              "package:stats"
>> [13] "package:startupmsg"         "package:graphics"
>> "package:methods"            "Autoloads"
>> [17] "package:base"
>> 
>>> options("defaultPackages")
>> $defaultPackages
>> [1] "datasets"  "utils"     "grDevices" "graphics"  "stats"
>> "methods"
>> 
>>> sessionInfo()
>> R version 2.9.0 (2009-04-17)
>> i386-pc-mingw32
>> 
>> locale:
>> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
>> States.1252;LC_MONETARY=English_United
>> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>> 
>> attached base packages:
>> [1] grDevices datasets  utils     stats     graphics  methods   base
>> 
>> 
>> other attached packages:
>> [1] RandVar_0.6.7          distrEx_2.1            actuar_1.0-2
>> evd_2.2-4              distr_2.1.1
>> [6] SweaveListingUtils_0.2 sfsmisc_1.0-7          startupmsg_0.6
>> 
>> loaded via a namespace (and not attached):
>> [1] distrMod_2.1 MASS_7.2-46  stats4_2.9.0
>> 
>> Thanks for any help on this,
>> David L. Reiner
>> 
>> 
>> 
>> 
>> This e-mail and any materials attached hereto, including, without 
>> limitation, all content hereof and thereof (collectively, "Rho
Content") 
>> are confidential and proprietary to Rho Trading Securities, LLC
("Rho") 
>> and/or its affiliates, and are protected by intellectual property
laws. 
>> Without the prior written consent of Rho, the Rho Content may not (i)
be 
>> disclosed to any third party or (ii) be reproduced or otherwise used
by 
>> anyone other than current employees of Rho or its affiliates, on
behalf of 
>> Rho or its affiliates.
>> 
>> THE RHO CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR
WARRANTIES OF 
>> ANY KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW,
RHO 
>> HEREBY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED,
RELATING TO 
>> THE RHO CONTENT, AND NEITHER RHO NOR ANY OF ITS AFFILIATES SHALL IN
ANY 
>> EVENT BE LIABLE FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING,
BUT 
>> NOT LIMITED TO, DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE

>> DAMAGES, LOSS OF PROFITS AND TRADING LOSSES, RESULTING FROM ANY
PERSON'S 
>> USE OR RELIANCE UPON, OR INABILITY TO USE, ANY RHO CONTENT, EVEN IF
RHO IS 
>> ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR IF SUCH DAMAGES WERE 
>> FORESEEABLE.
>> 
>> ______________________________________________
>> 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.
>> 
>
> -- 
> 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 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> ______________________________________________
> 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.
>

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list