print

0th

Percentile

Print methods for permutation objects

Print methods for permutation objects with matrix-like printing for words and bracket notation for cycle objects.

Keywords
symbolmath
Usage
# S3 method for cycle
print(x, ...)
# S3 method for word
print(x, h = getOption("print_word_as_cycle"), ...)
as.character_cyclist(y,comma=TRUE)
Arguments
x

Object of class permutation with word objects dispatched to print.word() and cycle objects dispatched to print.cycle()

h

Boolean, with default TRUE meaning to coerce words to cycle form before printing. See details

...

Further arguments (currently ignored)

y,comma

In as.character.cyclist(), argument y is a list of cycles (a cyclist); and comma is Boolean, specifying whether to include a comma in the output

Details

Printing of word objects is controlled by options("print_word_as_cycle"). The default behaviour is to coerce a word to cycle form and print that, with a notice that the object itself was coerced from word.

If options("print_word_as_cycle") is FALSE, then objects of class word are printed as a matrix with rows being the permutations and fixed points indicated with a dot.

Function as.character_cyclist() is an internal function used by print.cycle(), and is not really designed for the end-user. It takes a cyclist and returns a character string.

Value

Returns its argument invisibly, after printing it.

See Also

nicify_cyclist

Aliases
  • print.permutation
  • print.word
  • print.cycle
  • as.character.cycle
  • as.character_cyclist
Examples
# NOT RUN {
# generate a permutation in *word* form:
x <- rperm(4,9)

# default behaviour is to print in cycle form irregardless:
x

# change default using options():
options(print_word_as_cycle=FALSE)

# objects in word form now printed using matrix notation:
x

# printing of cycle form objects not altered:
as.cycle(x)

# restore default:
options(print_word_as_cycle=TRUE)

as.character_cyclist(list(1:4,10:11,20:33))  # x a cyclist;
as.character_cyclist(list(c(1,5,4),c(2,2)))  # does not check for consistency
as.character_cyclist(list(c(1,5,4),c(2,9)),comma=FALSE)
# }
Documentation reproduced from package permutations, version 1.0-5, License: GPL-2

Community examples

Looks like there are no examples yet.