Suppose I have an R vector of unique elements such as x <- c(1,2,3,4,5).
x <- c(1,2,3,4,5)
Is there a function to give me a list of all possible partitions of this vec
Does this give you what you are looking for,
install.packages("gregmisc", dependencies = TRUE) library(gregmisc) x <- c(1,2,3,4,5) for(i in 1:length(x)) { print(combinations(5,i,x,repeats=TRUE)) }