为什么这两个data.table
命令的结果不同?
DT[num == 1, .N] # returns wrong result
和
DT[(num == 1), .N] # returns correct result
num
是data.table
DT
编辑:sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C
[5] LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.9.4
通过命名空间加载(而不是附加): [1] Rcpp_0.11.4 chron_2.3-45 plyr_1.8.1 reshape2_1.4.1 stringr_0.6.2 tools_3.1.2