I've got a package with a data object (.rda) that was originally created by another package and seems to have a reference to its original namespace.
The man page for load() explains:
Objects can be saved with references to namespaces, usually as part of the environment of a function or formula. As from R 3.1.0 such objects can be loaded even if the namespace is not available: it is replaced by a reference to the global environment with a warning. The warning identifies the first object with such a reference (but there may be more than one).
I need to remove this reference, as it is causing warnings to be thrown during package checks. I've tried just loading and re-saving the object but don't see how to modify the namespace. Any suggestions?
Edit:
The object is a 'network'. I haven't figured out another example, but should be able to reproduce the same example:
install.packages('ndtv') library(ndtv) loadedNamespaces() [1] "animation" "base" "datasets" "graphics" [5] "grDevices" "methods" "ndtv" "network" [9] "networkDynamic" "sna" "statnet.common" "stats" [13] "tools" "utils" data(msm.sim) loadedNamespaces() [1] "animation" "base" "datasets" "ergm" [5] "graphics" "grDevices" "methods" "ndtv" [9] "network" "networkDynamic" "sna" "statnet.common" [13] "stats" "tools" "utils" notice the addition of the 'ergm' namespace
41 Answer
I think I've resolved this by creating a new network object, and copying each of the named elements of the msm.sim object over to the new object, then re-saving the new object over the old one. Perhaps the namespace attachment was triggered by a function attached to msm.sim when it was generated by the ergm package so I don't see it when calling edit() on the object? There must be a better way. I still think that if name-space triggering elements can be attached to an object, there should be function to list what they are and where they are attached.