[Rcpp-devel] How to detach a package completely

Christian Gunning xian at unm.edu
Sat Aug 30 20:48:37 CEST 2014


Have you tried Hadley's devtools package? It probably has the best tools
for auto-reloading packages. On occasion it will jam on me and I have to
restart R, but most times load_all("Hello", recompile=T) should do what you
want.

---Christian

Quote:
Dear everybody
I apologize whether this question has been already answered but I read the
documentation and I surfed the web without solving my issue.

>From time to time, I use R to develop my own packages.
For testing purposes, I need frequently
***to detach the previous version and attach a more recent built without
leaving the R session***.

I'm able to do this with the command
detach(name = "Hello", unload = TRUE, force = TRUE)
if I include in the source package a
zzz.R file
with the function
.onUnload <- function(libpath = NULL)
{
  library.dynam.unload("Hello", libpath)
}
("Hello" is the name of the package I used for testing)

However, if "Hello" links and imports "Rcpp" (and an import(Rcpp) directive
is included in NAMESPACE) all this stuff does not work, in the sense that
even detaching and building a new version of "Hello", the previous one is
attached.
On the other side, if I quit R and I open another session, the last version
of "Hello" is attached successfully.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140830/6de14a96/attachment.html>


More information about the Rcpp-devel mailing list