| swap | R Documentation |
Length-2 cycles; swap a pair of elements
swap(a, b)
a, b |
Integers |
Swaps two elements. Vectorized; uses standard recycling.
Returns a permutation in cycle form
If the first argument equals the second, the identity permutation is returned.
Cycles of the form (1n), that is, swap(1, n), are used
extensively in inst/outer_automorphisms_of_S6.Rmd.
Robin K. S. Hankin
as.cycle
swap(2, 8)
swap(5, 1:9)
swap(1:8, 8:1)
swap(sample(9), sample(9))
rcyc(10,4)^swap(1,9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.