[Rcpp-devel] How to detach a package completely

Cipollini Fabrizio cipollini.fabrizio at gmail.com
Sun Aug 31 16:37:33 CEST 2014


Dear Christian

On Sat, Aug 30, 2014 at 8:48 PM, Christian Gunning <xian at unm.edu> wrote:

> 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.
>
I tried your suggestion (using also 'export_all = FALSE')  but I got the
warning message

Loading Hello
Warning in setup_ns_exports(pkg, export_all) :
  Objects listed as exports, but not present in namespace: .package,
helloRcpp1, helloCpp1, helloC1, helloF1

and the successive error message

Error in print(helloF1(ny)) : could not find function "helloF1"

(where "helloF1" is one of the functions I'm testing).
Note that I exported in the NAMESPACE file all functions listed in above
warning message.

Thank you for your help
Fabrizio Cipollini



> ---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/20140831/4122a964/attachment.html>


More information about the Rcpp-devel mailing list