Sorry for the double post. But on the same topic, in more general sense, how does one select rows based off of any logical?
For example: DF = data.frame(x=1:3,y=4:6,z=7:9) ds <- 1 new.DF <- DF[which(DF$x > ds),] Thanks, Ben On Fri, Aug 19, 2011 at 4:57 PM, Ben Goldstein <[email protected]>wrote: > Hello All, > > 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. > > For example, in data.frame i'd do: > > DF = data.frame(x=1:3,y=4:6,z=7:9) > ds <- c(1,2) > new.DF <- DF[which(! DF$x %in% ds),] > > where, ds is a vector of values that I don't want matched. So, new.DF > would just consist of the third row. > > How do I do something comparable with data.table? > > I have: > DT = data.table(DF) > setkey(DT,x) > and then I know I can select ds, by: > DT[ds] > but something like: > DT[!ds] obviously doesn't work... > > Thanks, > > Ben >
_______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
