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.eichner at math.uni-giessen.de Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/~gcb7
---------------------------------------------------------------------
On Tue, 1 Sep 2009,
Ted.Harding at manchester.ac.uk wrote:
> 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 can of course write my own, using good old looping technology
> or similar, but it would be good to find one which did it quick
> and snappy, at the compiled level.
>
> A Site Search in Function on "all subsets" didn't seem to
yield
> anything of the kind, which surprised me. Maybe I overlooked
> something ...
>
> (This is prompted by the recent "OT" discussion on "HT vs.
HH",
> to which I want to respond later).
>
> With thanks,
> Ted.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 01-Sep-09 Time: 09:09:09
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>