[R] Function for all 2^N subsets of N
(Ted Harding)
Ted.Harding at manchester.ac.uk
Tue Sep 1 10:09:12 CEST 2009
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 ------------------------------
More information about the R-help
mailing list