5

Every time I update R something must happen... Anyway, this time (apparently only for data.table, other packg like ggplot2 and all those imported by it are fine) I get this:

> library("data.table", lib.loc="C:/Program Files/R/R-3.0.2/library")
data.table 1.8.10  For help type: help("data.table")
> detach("package:data.table", unload=TRUE)
Warning messages:
1: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-10-04 18:33:03’, when none found
2: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-10-04 18:33:03’, when none found
3: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-10-04 18:33:03’, when none found
4: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-10-04 18:33:03’, when none found
5: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-10-04 18:33:03’, when none found
6: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-10-04 18:33:03’, when none found

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.0.2

Same exact output when uninstalling the package and reinstalling from source using Rtools. They just warnings I know but I'm curious/a bit worried if this will imply something else later on.

EDIT: with Rcpp as well (30 warnings) and differently than data.table, Rpcc is not working:

> evalCpp('2 * M_PI')
Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput,  : 
  SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'
Michele
  • 8,563
  • 6
  • 45
  • 72
  • Hi, have you tried quitting `R` and then relaunching? – Ricardo Saporta Oct 04 '13 at 18:10
  • no idea what's going on, but I've been getting those same warnings when installing `data.table` recently (but not when using it like you and actually not on all systems) – eddi Oct 04 '13 at 18:40
  • 1
    oh wait, I *am* getting these on `detach` as well on both linux and windows with `data.table` 1.8.10 (windows) and 1.8.9 (linux) – eddi Oct 04 '13 at 19:21
  • @RicardoSaporta yes I am. I'm on `RStudio` and it kindly suggests you to restart `R` when uninstalling and re-installing a package :-) – Michele Oct 04 '13 at 19:37
  • @eddi This would make sense only on windows (or prob not at all...) but I was thinking: Do you `data.table` and Rcpp` rely on `Rtools` somehow? Basically, I'm just trying to think what differs between packages like those two and others like `ggplot2` and `scales` (which work fine). These last two are in written in pure `R`, aren't they? – Michele Oct 04 '13 at 19:45
  • I don't have `Rcpp` issues on linux and don't have it working on windows for other, unrelated reasons – eddi Oct 04 '13 at 20:00
  • I've never seen this warning before. But I never detach data.table either. I see the same message but only when unload=TRUE. Searching for the warning message threw [this](http://stackoverflow.com/questions/16173658/dynamically-generate-reference-classes) up, any good? But why the need to detach? – Matt Dowle Oct 04 '13 at 23:31
  • @MattDowle There's no need. But it wasn't happening before R3.0.2. This happens with `Rcpp` as well. The latter doesn't work at all, you can see from the result of `evalCpp('2 * M_PI')`. Tomorrow I'll try some basic `data.table` funs and see what happens. – Michele Oct 04 '13 at 23:41
  • I'm on R3.0.1 and it's happening here. But why do we need to worry about a warning from something we never need to do? – Matt Dowle Oct 04 '13 at 23:48
  • @MattDowle I have detached packages before for various reasons, e.g. to update it or because of name conflicts – eddi Oct 05 '13 at 04:35
  • @MattDowle It never happened to me before, so I was curious... – Michele Oct 05 '13 at 07:20
  • Michele, @eddi Maybe we need a `setPackageName("data.table",.global)` as per the question I linked to: http://stackoverflow.com/questions/16173658/dynamically-generate-reference-classes – Matt Dowle Oct 05 '13 at 07:59
  • 1
    Do not install R in a path with spaces. – Dirk Eddelbuettel Oct 05 '13 at 12:52
  • @MattDowle I'm not sure where that would go - I tried adding it at the very top of `.onLoad` and `.onAttach` and nothing changed (I don't really understand package structure well enough to know where that should go) – eddi Oct 06 '13 at 04:05
  • @DirkEddelbuettel sorry, but that just sounds like you're saying - don't install R on Windows, and besides I can replicate this issue regardless of OS or R path name – eddi Oct 06 '13 at 04:05
  • @eddi That is not what I said. The **R on Windows FAQ** recommends to avoid spaces in pathnames if you want to **compile packages**. And it is not hard: just select e.g. `C:/R/R-$version/'. – Dirk Eddelbuettel Oct 06 '13 at 05:23
  • @DirkEddelbuettel But it happens for me on Linux as well with no spaces. – Matt Dowle Oct 06 '13 at 07:55
  • @eddi Maybe add that call to data.table.R just after .global being defined. Or maybe it's the S4 classes side and not .global at all. Otherwise it seems like one for r-devel. – Matt Dowle Oct 06 '13 at 08:05
  • @MattDowle nope, that didn't change anything either :\ – eddi Oct 06 '13 at 21:48
  • @DirkEddelbuettel does it make sense to you that compiling a cpp source file from RStudio Server fails (with error `SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'`), whilst doing the same directly from R (in the terminal of the Ubuntu server) succeeds? It's the same `R` engine after all... – Michele Oct 07 '13 at 13:39
  • Given that the code is the same, and the toolchain is the same, and nobody else has ever seen the error ... would lead me to think the problem is at your end and of your making. And three-line comment forms are not the right way to report problems, or seek help. I am done here---you know where to find the mailing list. But please make it as _complete and reproducible_ as you can. – Dirk Eddelbuettel Oct 07 '13 at 13:47
  • @DirkEddelbuettel ok sorry, I will. I tried a quick question here just because the code I tried to compile (both in RStudio and in R via terminal) was a very simple and short script taken by the `Rcpp` docs, so (in my mind) supposed to work anywhere. – Michele Oct 07 '13 at 14:40
  • `evalCpp('2 * M_PI')` _does_ work everywhere provided R, Rtools and Rcpp are installed correctly which is _why_ we promote it as a litmus test. It fails at your end --> **your system** is different. But I cannot guess from three lines what you did wrong with your installation. Final post. – Dirk Eddelbuettel Oct 07 '13 at 14:50

1 Answers1

4

The warning is sent by the getPackageName() function, when called e.g. on the parent.env of the data.table namespace.

Here's the relevant part of the calls stack:

# 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)

... # where 11: tryCatch(unloadNamespace(pkgname), error = function(e) warning(gettextf("%s namespace cannot be unloaded:\n ", # sQuote(pkgname)), conditionMessage(e), call. = FALSE, domain = NA)) # where 12: detach("package:data.table", unload = TRUE)

For instance, try:

getPackageName(parent.env(getNamespace('data.table')))

and

findClass('data.frame', getNamespace('data.table'))

It is fixed in R-devel (not verified by myself but I trust J. Chambers on this one).

Karl Forner
  • 4,175
  • 25
  • 32