Dear all,

Consider this code:
>library("data.table")
>unloadNamespace('data.table')

It produces some warnings
Warning in FUN(X[[1L]], ...) :
  Created a package name, ‘2013-10-29 17:05:51’, when none found
Warning in FUN(X[[1L]], ...) :
  Created a package name, ‘2013-10-29 17:05:51’, when none found
...

The warning is produced by the getPackageName() function.
e.g.
getPackageName(parent.env(getNamespace('data.table')))

I was wondering what could be done to get rid of these warnings, which I
believe in the case "unloadNamespace" case are irrelevant.

The stack of calls is:
# where 3: sapply(where, getPackageName)
# where 4: findClass(what, classWhere)
# where 5: .removeSuperclassBackRefs(cl, cldef, searchWhere)
# where 6: methods:::cacheMetaData(ns, FALSE, ns)
# where 7: unloadNamespace(pkgname)

So for instance:
>findClass('data.frame', getNamespace('data.table'))
generates a warning which once again seems irrelevant.

On the top of my head, I could imagine adding an extra argument to
getPackageName, say warning = TRUE, which would be set to FALSE in the
getPackageName call in findClass() body.

I also wonder if in the case of import namespaces, getPackageName() could
not find a more appropriate name:
>parent.env(getNamespace('data.table'))
<environment: 0x7f6ce4d04040>
attr(,"name")
[1] "imports:data.table"

This namespace has a name that might be used to generate the package name.

My question is: what should be done ?

Thanks for your attention.

Karl Forner

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to