[Rd] unloadNamespace
Gabriel Becker
gmbecker at ucdavis.edu
Thu Jan 8 16:52:02 CET 2015
Paul,
My switchr package (https://github.com/gmbecker/switchr) has the
flushSession function which does what you want and seems to work (on my
test machine at least).
I havent tested it under a recent Rdevel, or with that specific package,
however I will soon, as the overarching model of switchr relies on this
working.
If you do try it before me with that package, please let me know whether it
works or not.
~G
On Thu, Jan 8, 2015 at 7:45 AM, Paul Gilbert <pgilbert902 at gmail.com> wrote:
> 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
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Gabriel Becker, PhD
Alumnus
Statistics Department
University of California, Davis
[[alternative HTML version deleted]]
More information about the R-devel
mailing list