R's data.table
package offers fast subsetting of values based on keys.
So, for example:
set.seed(1342)
df1 <- data.table(group = gl(10, 10, labels = letters[1:10]),
value = sample(1:100))
setkey(df1, group)
df1["a"]
will return all rows in df1 where group == "a".
What if I want all rows in df1
where group != "a"
. Is there a concise syntax for that using data.table
?