Lets say I have the following list:
org <- list(1L, c(1L,2L), 2L, c(1L,3L), c(1L,2L,3L), c(2L,3L), 3L, 4L)
str(org)
#> List of 8
#> $ : int 1
#> $ : int [1:2] 1 2
#> $ : int 2
#> $ : int [1:2] 1 3
#> $ : int [1:3] 1 2 3
#> $ : int [1:2] 2 3
#> $ : int 3
#> $ : int 4
Now I would like to obtain the positions in the list with the complete sets. So in the example the positions 1,2,3,4,6,7 are all subsets of the 5th element in the list. The 8th element in the list is not a subset of other elements in the list. So, I would like to have returned the position of these elements. In this case: 5 and 8.
compl <- c(5, 8)
Can I easily achieve this using data.table?
Created on 2021-04-29 by the reprex package (v1.0.0)