[R] Permutations

Erich Neuwirth erich.neuwirth at univie.ac.at
Wed Jul 14 09:49:00 CEST 2004


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 at 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




More information about the R-help mailing list