I couldn\'t find an answer to this anywhere, so here\'s my solution.
The question is: how can you calculate a power set in R?
It is possible to do this with
The below should create a power set, minus the empty set element.
powerset <- function(x) { sets <- lapply(1:(length(x)), function(i) combn(x, i, simplify = F)) unlist(sets, recursive = F) }