rperm: Random permutations

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/permfuns.R

Description

Create a word object of random permutations

Usage

1
rperm(n,r,moved=NA)

Arguments

n

Number of permutations to create

r

Size of permutations

moved

Integer specifying how many elements can move (that is, how many elements do not map to themselves), with default NA meaning to choose a permutation at random. This is useful if you want a permutation that has a compact cycle representation

Value

Returns an object of class word

Note

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).

Author(s)

Robin K. S. Hankin

See Also

size

Examples

1
2
3
4
5
rperm(30,9)
as.cycle(rperm(30,9))


rperm(10,9,2)

Example output

Attaching package:permutationsThe following object is masked frompackage:stats:

    cycle

 [1] (13587269)        (135)(246)(89)    (1697)(28453)     (1872354)        
 [5] (1369)(25874)     (186527)(39)      (15437)(68)       (29486357)       
 [9] (1625)(39)(487)   (1985)(27346)     (1958743)(26)     (15674289)       
[13] (19824576)        (1625873)         (125)(34)(68)(79) (168452397)      
[17] (157)(246983)     (169)(2784)(35)   (1429)(37)(56)    (234567)(89)     
[21] (148)(256)(379)   (1738469)         (192)(468)        (14296)(3587)    
[25] (27946538)        (164839725)       (16453)(2798)     (197)(235)       
[29] (18765)(39)       (194)(256)(37)   
 [1] (132)(469)(58)  (18943)(275)    (12753)(48)     (1867)(24539)  
 [5] (148937625)     (17)(28639)     (139862)(45)    (1769)(248)(35)
 [9] (1392457)(68)   (154698273)     (15726849)      (1485736)(29)  
[13] (1967452)       (18)(2369)(57)  (12)(387945)    (129)(35674)   
[17] (192865437)     (1827465)(39)   (192534768)     (138)(274)(56) 
[21] (1937248)       (193)(27)(468)  (2396)(45)(78)  (38)(569)      
[25] (12)(3984675)   (1365482)       (179324)        (1358246)      
[29] (162795)(38)    (12897463)     
 [1] ()   (59) (29) ()   (17) (12) (36) (39) (25) (47)

permutations documentation built on Nov. 13, 2020, 1:14 a.m.