[R] enumerate subsets

2008-07-20 Thread lamack lamack
Dear all, is there a R function that enumerate a partition of a vector of size n? (of course for n not very large). I would like enumerate all the (2 power n)-1 sub-sets. (2 power n)-1 since (2 power n) includes de empty subset. Best Regards. ps. It is not a homework. I never posted homework

Re: [R] enumerate subsets

2008-07-20 Thread Peter Dalgaard
lamack lamack wrote: Dear all, is there a R function that enumerate a partition of a vector of size n? (of course for n not very large). I would like enumerate all the (2 power n)-1 sub-sets. (2 power n)-1 since (2 power n) includes de empty subset. Best Regards. ps. It is not a homework. I

Re: [R] enumerate subsets

2008-07-20 Thread jim holtman
Can you give a small example of what you data looks like and what you think the output should be. Have you looked at 'combn'? On Sun, Jul 20, 2008 at 4:33 PM, lamack lamack [EMAIL PROTECTED] wrote: Dear all, is there a R function that enumerate a partition of a vector of size n? (of course

Re: [R] enumerate subsets

2008-07-20 Thread Gabor Grothendieck
Try this replacing letters[1:4] with your set: do.call(expand.grid, as.data.frame(rbind(letters[1:4], NA))) V1 V2 V3 V4 1 abcd 2 NAbcd 3 a NAcd 4 NA NAcd 5 ab NAd 6 NAb NAd 7 a NA NAd 8 NA NA NAd 9