Re: [R] Permutations

From: Erich Neuwirth <erich.neuwirth_at_univie.ac.at>
Date: Wed 14 Jul 2004 - 17:49:00 EST

Perhaps what you want might better be described as ordered partitions?

Is what you want the following:

We study sequences of length 12 and divide them in 4 segments
position 1 2 3, position 4 5 6,
position 7 8 9, position 10 11 12,

Find all permutation sequences of the numbers 1 to 12 with the property that all segment sequences are monotonically increasing.

I think that produces what you need.
Since the segments are ordered, you avoid intra-block permutations.

If that is what you want, writing a recursive function should not be too hard.

Jordi Altirriba Gutiérrez wrote:

> Dear R users,
> I’m a beginner user of R and I’ve a problem with permutations that I
> don’t know how to solve. I’ve 12 elements in blocks of 3 elements and I
> want only to make permutations inter-blocks (no intra-blocks) (sorry if
> the terminology is not accurate), something similar to:
>
> 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12 ----------1st permutation
>
> 1 3 2 | 4 5 6 | 7 8 9 | 10 11 12 NO
> - -
> 3 2 1 | 4 5 6 | 7 8 9 | 10 11 12 NO
> - - -
> 1 2 4 | 3 5 6 | 7 8 9 | 10 11 12 YES-----2nd permutation
> - -
> 4 5 6 | 1 2 3 | 7 8 9 | 10 11 12 YES-----3rd permutation
> - - - - - -
> 4 5 6 | 2 1 3 | 7 8 9 | 10 11 12 NO
> - -
> ....
>
> Thanks for your time,
>
> Jordi Altirriba
> Ph D student
>
> Hospital Clinic – Barcelona - Spain
>
>
> MSN Motor. http://motor.msn.es/researchcentre/
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

-- 
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Jul 14 17:57:27 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:36:03 EST