Subset data.table by logical column

后端 未结 3 2206
猫巷女王i
猫巷女王i 2020-12-03 09:51

I have a data.table with a logical column. Why the name of the logical column can not be used directly for the i argument? See the example.

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-03 10:38

    This should also work and is arguably more natural:

    setkey(dt, x)
    dt[J(TRUE)]
    dt[J(FALSE)]
    

提交回复
热议问题