[prev in list] [next in list] [prev in thread] [next in thread]
List: r-help
Subject: [R] getting all circular arrangements without accounting for order
From: Ranjan Maitra <maitra () email ! com>
Date: 2018-03-30 1:48:32
Message-ID: 20180329204832.bf152d60cdebb7ec49fb0719 () email ! com
[Download RAW message or body]
Dear friends,
I would like to get all possible arrangements of n objects listed 1:n on a circle.
Now this is easy to do in R. Keep the last spot fixed at n and fill in the rest using \
permuations(n-1, n-1) from the gtools package.
However, what if clockwise or counterclockwise arrangements are the same? I know that \
half of the above (n - 1)! arrangements are redundant.
Is there an easy way to list these (n-1)!/2 arrangements?
I thought of only listing the first half from a call to permuations(n - 1, n - 1), \
but while this holds for n = 4, it does not for n = 5. So, I am wondering if there is \
another function or tweak which would easily do this.
Many thanks in advance for any help. and best wishes,
Ranjan
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic