Learn R Programming

permutations (version 1.1-9-1)

c: Concatenation of permutations

Description

Concatenate words or cycles together

Usage

# S3 method for word
c(...)
# S3 method for cycle
c(...)
# S3 method for permutation
rep(x, ...)

Arguments

...

In the methods for c(), objects to be concatenated, which all must be of the same type: either all word, or all cycle

x

In the method for rep(), a permutation object

Author

Robin K. S. Hankin

See Also

size

Examples

Run this code
x <- as.cycle(1:5)
y <- cycle(list(list(1:4,8:9), list(1:2)))


# concatenate cycles:
c(x,y)

# concatenate words:
c(rperm(5,3),rperm(6,9))   # size adjusted to maximum size of args


# repeat words:
rep(x, times=3)

# c(id, rperm())  # fails: elements are of different types, one cycle, one word.
c(as.word(id), rperm())   # works: coerce id [which is a cycle] to word form
c(id, as.cycle(rperm()))  # works: coerce rperm() [which is a word] to cycle form

Run the code above in your browser using DataLab