How do we generate in R all possible combinations (of variable length, so that the resulting list can be of length 1, 2 or 3 if there are 3 elements) from a vector of variable length:
# say we have a vector of length 3:
vec = letters[1:3]
ret = list('a', 'b', 'c', 'ab', 'ac', 'bc', 'abc', 'a,b', 'a,c', 'a,bc', 'b,c', 'ac,b', 'ab,c', 'a,b,c')
Thank you!