I just got bitten by a nasty bug in my code:

library(data.table)
eso = data.table(pH=rnorm(10),channel=1:2,key="channel")
chan = 1
channel = chan

eso[J(chan)]    # not a column name, returns what I want
eso[J(channel)] # channel is a column and key, returns all

>From a standpoint of evaluation, it is clear to me what happens, but I find
this behavior highly confusing. I would wish if the latter could optionally
be flagged with a warning, in case this is not "by design".

Dieter





--
View this message in context: 
http://r.789695.n4.nabble.com/J-channel-J-chan-give-different-results-when-chan-channel-tp4648911.html
Sent from the datatable-help mailing list archive at Nabble.com.
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to