Re: [Rd] reinforce library to re-load

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed, 04 Jul 2007 06:36:53 +0100 (BST)

Please don't post to multiple lists: I am replying only to R-devel.

You should detach your package, and if it has a namespace unload it, before attempting to reload it. Something like

detach("package:foo")
library(foo)

or

unloadNamespace("foo") # this also detaches the package library(foo)

If the package has a DLL, this will in general not reload that. Now in quite a few cases you cannot successfully unload a DLL, but library.dynam.unload is provided if you want to do this (including in your package's .Last.lib or .onUnload hooks).

On Tue, 3 Jul 2007, Weiwei Shi wrote:

> Hi,
>
> I am wondering if there is a parameter in library() so that it can
> reinforce package to be reloaded. It helps when you test your modified
> package by yourself. Otherwise, my way is to re-start Rgui.
>
> (by reading ?library, I understand this option is not implemented)
> "...Both functions check and update the list of currently loaded
> packages and do not reload a package which is already loaded.
> (Furthermore, if the package has a name space and a name space of that
> name is already loaded, they work from the existing names space rather
> than reloading from the file system.)"
>
> Thanks.
>
>

-- 
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-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 04 Jul 2007 - 05:40:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 04 Jul 2007 - 15:36:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.