Re: [R] combinations with replications

From: Jim Lemon <>
Date: Thu, 31 Jul 2008 21:19:17 +1000

On Thu, 2008-07-31 at 02:29 -0700, MarinaTarantini wrote:
> Dear all,
> Is there a way to compute and list all combinations with replication of two
> elements in sets of 8 elemnts?
> For example, I've two elements, 0 and 1, and I would to get all possible
> combinations with replication such as, for example, 00000000, 00000001,

> 00000010, and so on. They are 2^8 and it's very hard to list handly!!

Hi Marina,
Here's a Q&D solution for the specific problem that could easily be extended to different numbers of elements (although it would blow out very quickly)..

for(i in 1:7) {
 for(comb in 1:combcol) {

Jim mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 31 Jul 2008 - 11:19:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 31 Jul 2008 - 12:33:01 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive