3
自我索引这里是我的意思,这使得事情说清楚的例子:错误而data.table
require(data.table)
x = data.table(a=1:10, idx=sample(c(TRUE, FALSE), 10, replace=TRUE))
x[idx]
Error in eval(expr, envir, enclos) : object 'idx' not found
但是,下面的工作:
x[idx[]]
#a idx
#1: 2 TRUE
#2: 5 TRUE
#3: 7 TRUE
#4: 9 TRUE
#5: 10 TRUE
任何想法,这里发生了什么?
有趣:'X [IDX == TRUE]'也适用。 'x [(idx)]''也是。 – 2013-05-12 21:13:17
http://thread.gmane.org/gmane.comp.lang.r.datatable/1588/focus=1589 – GSee 2013-05-12 21:19:50
明白了。如果其他人发现它有用但可以随时关闭,我会留下这个问题。 – Alex 2013-05-12 21:28:50