Setoperations {gRbase} | R Documentation |
Miscellaneous set operations.
is.subsetof(x, set) is.insetlist(x, setlist, index=FALSE) removeRedundant(setlist, maximal = TRUE, index = FALSE)
x, set |
Vectors representing sets |
setlist |
List of vectors (representing a set of subsets) |
maximal |
Logical; see section 'Details' for a description. |
index |
Logical; should indices (in setlist) be returned or a set of subsets. |
'setlist' is a list of vectors representing a set of subsets; i.e. V1,...VQ where Vk is a subset of some base set V.
is.insetlist
: Checks if the set x is in one of the Vk's.
removeRedundant
: Returns those Vk which are not contained in other
subsets; i.e. gives the maximal sets. If maximal is FALSE then returns
the minimal sets; i.e. Vk is returned if Vk is contained in one of the
other sets Vl and there are no set Vn contained in Vk.
Notice that the comparisons are made by turning the elements into characters and then comparing these. Hence 1 is identical to "1".
Søren Højsgaard, sorenh@agrsci.dk
is.subsetof(c(1,2),c(1,2,3)) is.subsetof(c(1,2,3), c(1,2)) l <- list(c(1,2),c(1,2,3),c(2,4),c(5,6), 5) #subsetofList(c(1,2), l) #subsetofList(c(1,2,3,4), l) removeRedundant(l) removeRedundant(l, maximal=FALSE) is.insetlist (c(2,4), l) is.insetlist (c(2,8), l)