当我使用dt[colA=='x'&colB=='y', mycol:=y]
之类的语法并且没有符合条件的行时,我会打印整个dt
。有没有办法抑制此输出或以某种方式禁用它?
示例:
dt = data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9)
dt[x=='j',y:=5] # works fine, nothing is printed
dt[x=='j'&v==10,y:=5] # dt is printed
dt[x=='j'|v==10,y:=5] # dt is printed