[Rd] unloadNamespace

Paul Gilbert pgilbert902 at gmail.com
Thu Jan 8 16:45:24 CET 2015


In the documentation the closed thing I see to an explanation of this is 
that ?detach says "Unloading some namespaces has undesirable side effects"

Can anyone explain why unloading tseries will load zoo? I don't think 
this behavior is specific to tseries, it's just an example. I realize 
one would not usually unload something that is not loaded, but I would 
expect it to do nothing or give an error. I only discovered this when 
trying to clean up to debug another problem.

R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
and
R Under development (unstable) (2015-01-02 r67308) -- "Unsuffered 
Consequences"
...
Type 'q()' to quit R.

 > loadedNamespaces()
[1] "base"      "datasets"  "graphics"  "grDevices" "methods"   "stats"
[7] "utils"
 > unloadNamespace("tseries") # loads zoo ?
 > loadedNamespaces()
  [1] "base"      "datasets"  "graphics"  "grDevices" "grid" 
"lattice"
  [7] "methods"   "quadprog"  "stats"     "utils"     "zoo"
 >

Somewhat related, is there an easy way to get back to a "clean" state 
for loaded and attached things, as if R had just been started? I'm 
trying to do this in a vignette so it is not easy to stop and restart R.

Paul



More information about the R-devel mailing list