Displaying 1 result from an estimated 1 matches for "new_bind".
Did you mean:
  newrbind
  
2011 May 31
1
assignInNamespace and new bindings
...4)
+++ src/library/utils/R/objects.R	(working copy)
@@ -252,8 +252,9 @@
              stop("environment specified is not a package")
          ns <- asNamespace(substring(nm, 9L))
      } else ns <- asNamespace(ns)
-    if(bindingIsLocked(x, ns)) {
-        unlockBinding(x, ns)
+    new_binding <- !exists(x,ns)
+    if( new_binding || bindingIsLocked(x, ns)) {
+        if(!new_binding) unlockBinding(x, ns)
          assign(x, value, envir = ns, inherits = FALSE)
          w <- options("warn")
          on.exit(options(w))
Romain
-- 
Romain Francois
Professional R Enth...