set.seed(77)
dt<-data.table(a=seq(1,5))
> dt
a
1: 1
2: 2
3: 3
4: 4
5: 5
dtsub<-dt[sample(5,3)]
> dtsub
a
1: 2
2: 3
3: 4
How to get dtsub padding (i.e. strings in dt that are not in dtsub)? Please generalize the solution to work in any data table.
Note. I am sure this was asked earlier, but my Google searches were empty. If this is a duplicate, mark it that way and point me in the right direction.
source
share