I have a data.table and want to pick those lines of the data.table where some values of a variable x are unique relative to another variable y
It\'s possible to get
The simpler data.table solution is to grab the first element of each group
data.table
> dt[, head(.SD, 1), by=.(y, x)] y x z 1: a 1 1 2: a 2 2 3: b 3 4 4: b 2 5 5: b 1 6