| rperm | R Documentation |
Function rperm() creates a word object of random permutations.
Function rcyc() creates random permutations comprising a single
(group-theoretic) cycle of a specified length. Functions
r1cyc() and rgs1() are low-level helper functions.
rperm(n=10, r=7, moved=NA)
rpermm(n=20, r=20, moved=NA)
rcyc(n, len, r=len)
r1cyc(len, vec)
rgs1(s)
rgivenshape(n, s, size=sum(s))
n |
Number of permutations to create |
r |
Size of permutations |
len |
Length of cycles in |
moved |
In function |
vec |
Vector of integers to generate a cycle from |
s, size |
Shape and size of permutations to create |
Function rperm() returns a simple vector of random permutations,
and rperm() gives a more complicated object.
Function rgivenshape() returns a random permutation with a given
shape. Argument s, specifying the shape, can include 1s (ones).
Although length-one cycles are dropped from the resulting permutation,
it is sometimes useful to include them to increase the size of the
result, see examples. If primary argument n is a vector of
length greater than 1, it is interpreted as the shape of the
permutation, and a single random permutation is returned. Setting print
option print_in_length_order to TRUE emphasises that every
element of the output of rgivenshape() has the same shape.
Returns a permutation object of class cycle, or class word
(rperm())
In function rperm(), argument moved specifies a
maximum number of elements that do not map to themselves; the
actual number of non-fixed elements might be lower (as some elements
might map to themselves). To control the number of non-fixed elements
precisely, use function rcyc() or rgivenshape().
Robin K. S. Hankin
size, print.permutation
rperm()
as.cycle(rperm(30, 9))
rperm(10, 9, 2)
rcyc(20, 5)
rcyc(20, 5, 9)
rgivenshape(10, c(2,3)) # shape (3,2), size 5
rgivenshape(10, c(2,3,1,1)) # shape (3,2), but size 7
rgivenshape(1:9)
allpermslike(rgivenshape(c(1, 1, 3, 4)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.