[S] combinations

Ed Callahan (callahan@envstat.com)
Sat, 25 Apr 1998 13:53:32 -0500


I need a function that returns a matrix of all the combinations of size k
from n items. So with n=4 and k=2 I would want

1 2
1 3
1 4
2 3
2 4
3 4

Does anyone know how to achieve this in S-Plus 4.0?

Thanks
Ed

----------------------------------
Edward Callahan
Environmental Statistics

callahan@envstat.com
http://www.envstat.com
----------------------------------

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news