[datatable-help] Question on inconsistent behavior

Damian Betebenner dbetebenner at nciea.org
Tue Feb 8 19:19:53 CET 2011


All,

In using data.table within a package I develop, I'm trying to avoid those pesky warnings about variables not having a binding. Because data.table scopes within the existing frame and code.tools isn't smart enough to detect
that, I'm getting a few of those pesky errors.

This brought me to the following inconsistent behavior (at least it appears that way to me):

tmp.dt <- data.table(ID=1:10, SCORE=rnorm(10))

tmp.dt[,SCORE]

and

tmp.dt[,"SCORE", with=FALSE]

The first returns a numeric vector whereas the second produces a data.table/data.frame with a single column. The second avoids those pesky warnings about unbound variables but I'd prefer to get the result provided by the
first.

Any suggestions/comments on the consistency of these results and/or the binding of variables when using data.table inside a package?

Best regards,

Damian

Damian Betebenner
Center for Assessment
PO Box 351
Dover, NH   03821-0351

Phone (office): (603) 516-7900
Phone (cell): (857) 234-2474
Fax: (603) 516-7910

dbetebenner at nciea.org<mailto:dbetebenner at nciea.org>
www.nciea.org<http://www.nciea.org/>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20110208/38cbe6b2/attachment.htm>


More information about the datatable-help mailing list