t(combn(4,2)) in the package *combinat* produce this function. Xiaohui
Michael Wolf wrote: > Dear all, > > Is there a function that computes all binomial combinations. > I am aware of the function "choose(n, k)" which computes the > number of such combinations, but not the actual combinations > themselves, e.g.: > > > choose(4, 2) > [1] 6 > > So I am looking for function that would give me the following > matrix as output, say: > > > function(4, 2) > [,1] [,2] > [1,] 1 2 > [2,] 1 3 > [3,] 1 4 > [4,] 2 3 > [5,] 2 4 > [6,] 3 4 > > Matlab has such function, but I could not find one in R. > > Please also reply directly to me: [EMAIL PROTECTED] > > Thanks much, > Michael > > ______________________________________________ > R-help@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. > ______________________________________________ R-help@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.