subsets | R Documentation |
Compute the subsets of a given set.
subsets(set, sizes = 1:length(set), include_null = FALSE)
set |
the original set |
sizes |
desired size(s) of subsets |
include_null |
should the empty vector be included? |
Note that this algorithm is run in R: it is therefore not intended to be the most efficient algorithm for computins subsets.
a list of subsets as vectors
utils::combn()
subsets(1:3)
subsets(1:3, size = 2)
subsets(1:3, include_null = TRUE)
subsets(c('a','b','c','d'))
subsets(c('a','b','c','d'), include_null = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.