[Rcpp-commits] r3933 - pkg/Rcpp/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 10 21:31:06 CET 2012


Author: jjallaire
Date: 2012-11-10 21:31:05 +0100 (Sat, 10 Nov 2012)
New Revision: 3933

Modified:
   pkg/Rcpp/R/Attributes.R
Log:
remove only objects that already exist

Modified: pkg/Rcpp/R/Attributes.R
===================================================================
--- pkg/Rcpp/R/Attributes.R	2012-11-10 20:20:20 UTC (rev 3932)
+++ pkg/Rcpp/R/Attributes.R	2012-11-10 20:31:05 UTC (rev 3933)
@@ -128,8 +128,12 @@
     
     # load the module if we have exported functions (else there is no module)
     if (length(context$exportedFunctions) > 0) {
+        
         # remove existing objects of the same name from the environment
-        remove(list = context$exportedFunctions, envir = env)
+        exports <- context$exportedFunctions
+        removeObjs <- exports[exports %in% ls(envir = env, all.names = T)]
+        remove(list = removeObjs, envir = env)
+        
         # load the module and populate the target environment
         dll <- dyn.load(context$dynlibPath)
         populate(Module(context$moduleName, PACKAGE = dll, mustStart = TRUE), 



More information about the Rcpp-commits mailing list