Re: [R] Function for all 2^N subsets of N

2009-09-01 Thread Terry Therneau
My first thought was the odometer() function, which is often useful for tasks like this. To my surprise it is not a part of the current R. I wonder why? It shouldn't be an Splus copyright issue as this was a part of my original S distribution (before Splus even existed), and used in an exampl

Re: [R] Function for all 2^N subsets of N

2009-09-01 Thread Ted Harding
On 01-Sep-09 08:33:41, Gerrit Eichner wrote: > Maybe > > expand.grid( rep( list( 0:1), 10)) > > does what you want. > Best regards -- Gerrit Thanks! That does seem to do the job. I hadn't thought of expand.grid(). Ted. > On Tue, 1 Sep 2009, > ted.hard...@manchester.ac.uk wrote: > >> Gree

Re: [R] Function for all 2^N subsets of N

2009-09-01 Thread Gerrit Eichner
Maybe expand.grid( rep( list( 0:1), 10)) does what you want. Best regards -- Gerrit - AOR Dr. Gerrit Eichner Mathematical Institute, Room 305 E gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giess

[R] Function for all 2^N subsets of N

2009-09-01 Thread Ted Harding
Greetings all! I have been searching the Site for a function, say "subsets", such that for instance subsets(10) would return a (say) matrix of indices to the 2^10 subsets of N items -- perhaps in the form of 2^10 rows each of which is 10 entries each either TRUE or FALSE. Or 1 or 0. Or ... I c