[R] function for grouping

Petr Savicky savicky at cs.cas.cz
Wed Jan 25 20:11:13 CET 2012


On Wed, Jan 25, 2012 at 09:10:13AM -0800, yan wrote:
> thanks petr,
> what if I got 200 elements, so I have to write expand.grid(x1=1, x2=1:2,
> x3=1:3, x4=1:3, x5=1:3....x200=1:3))?

Hi.

As others told you, the problem is not in reformulating
the command in a concise way, but in enormous memory
and time requirements of constructing all these
partitionings. Try to formulate further conditions,
which the required partitionings should satisfy. This
can reduce their number or allow a different approach
to solve your problem than listing all partitionings.

Petr Savicky.



More information about the R-help mailing list