Sorry if this is well-known, but I can't find an answer or maybe just don't know how to ask Google the right question. If I run the following code in R (3.1.1), I find that lattice:::xyplot.formula is still available (or maybe just a promise to it ... ???) even though I've used detach and unloadNamespace. Is there another step I'm missing? require(lattice) head(lattice:::xyplot.formula) detach(package:lattice) search() # No longer on search list loadedNamespaces() # But namespace is still loaded unloadNamespace("lattice") loadedNamespaces() # Namespace not loaded head(lattice:::xyplot.formula) # It is still accessible Kevin [[alternative HTML version deleted]]
Ah, here is the answer from the man page for ::: "...pkg:::name returns the value of the internal variable name. The namespace will be loaded if it was not loaded before the call, but the package will not be attached to the search path." Kevin On Wed, Sep 24, 2014 at 1:56 PM, Kevin Wright <kw.stat at gmail.com> wrote:> > > Sorry if this is well-known, but I can't find an answer or maybe just don't know how to ask Google the right question. If I run the following code in R (3.1.1), I find that lattice:::xyplot.formula is still available (or maybe just a promise to it ... ???) even though I've used detach and unloadNamespace. Is there another step I'm missing? > > require(lattice) > head(lattice:::xyplot.formula) > detach(package:lattice) > search() # No longer on search list > loadedNamespaces() # But namespace is still loaded > unloadNamespace("lattice") > loadedNamespaces() # Namespace not loaded > head(lattice:::xyplot.formula) # It is still accessible > > Kevin >-- Kevin Wright
Prof Brian Ripley
2014-Sep-24 19:09 UTC
[R] How do I really, I mean really, unload a package?
On 24/09/2014 19:56, Kevin Wright wrote:> Sorry if this is well-known, but I can't find an answer or maybe just don't > know how to ask Google the right question. If I run the following code in > R (3.1.1), I find that lattice:::xyplot.formula is still available (or > maybe just a promise to it ... ???) even though I've used detach and > unloadNamespace. Is there another step I'm missing?You just loaded it again. Read ?`:::` . The only way to make a package's namespace really unavailable is to uninstall it.> > require(lattice) > head(lattice:::xyplot.formula) > detach(package:lattice) > search() # No longer on search list > loadedNamespaces() # But namespace is still loaded > unloadNamespace("lattice") > loadedNamespaces() # Namespace not loaded > head(lattice:::xyplot.formula) # It is still accessible > > Kevin > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >PLEASE do: no HTML, do your homework before posting. -- Brian D. Ripley, ripley at stats.ox.ac.uk Emeritus Professor of Applied Statistics, University of Oxford 1 South Parks Road, Oxford OX1 3TG, UK
William Dunlap
2014-Sep-24 19:16 UTC
[R] How do I really, I mean really, unload a package?
Running pkg::func or pkg:::func has the side effect of loading pkg's namespace, if it is not already loaded. Use remove.packages() to remove the package from your machine if you want to make its namespace unloadable. Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Sep 24, 2014 at 11:56 AM, Kevin Wright <kw.stat at gmail.com> wrote:> Sorry if this is well-known, but I can't find an answer or maybe just don't > know how to ask Google the right question. If I run the following code in > R (3.1.1), I find that lattice:::xyplot.formula is still available (or > maybe just a promise to it ... ???) even though I've used detach and > unloadNamespace. Is there another step I'm missing? > > require(lattice) > head(lattice:::xyplot.formula) > detach(package:lattice) > search() # No longer on search list > loadedNamespaces() # But namespace is still loaded > unloadNamespace("lattice") > loadedNamespaces() # Namespace not loaded > head(lattice:::xyplot.formula) # It is still accessible > > Kevin > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.