<meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 13px; ">Hello All,<div>
<br></div><div>I just started using data.table and like some of the features. I apologize if this is a basic question, but I can't find it posted on the list. I want to select the rows that don't match a key.</div>
<div><br></div><div>For example, in data.frame i'd do:</div><div><br></div><div><div>DF = data.frame(x=1:3,y=4:6,z=7:9)</div></div><div>ds <- c(1,2)</div><div>new.DF <- DF[which(! DF$x %in% ds),]</div><div><br>
</div>
<div>where, ds is a vector of values that I don't want matched. So, new.DF would just consist of the third row.</div><div><br></div><div>How do I do something comparable with data.table?</div><div><br></div><div>I have:</div>
<div>DT = data.table(DF)</div><div>setkey(DT,x)</div><div>and then I know I can select ds, by:</div><div>DT[ds]</div><div>but something like:</div><div>DT[!ds] obviously doesn't work...</div><div><br></div><div>Thanks,</div>
<div><br></div><font color="#888888"><div>Ben</div></font></span>