[Rcpp-devel] How to detach a package completely

Cipollini Fabrizio cipollini.fabrizio at gmail.com
Sat Aug 30 09:14:36 CEST 2014


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.

I experimented different ways to solve the issue without any success.
Any help would be appreciated. I include my sessionInfo() below.

Best regards
Fabrizio Cipollini


> sessionInfo()

R version 3.1.1 (2014-07-10)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
LC_TIME=custom.UTF-8       LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8

 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C
          LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Hello_2014.08-1

loaded via a namespace (and not attached):
[1] Rcpp_0.11.2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140830/f94c5760/attachment.html>


More information about the Rcpp-devel mailing list