show: Print method for onions

showR Documentation

Print method for onions

Description

Show methods for onions

Usage

## S4 method for signature 'onion'
show(object)
onion_show(x,
     comp = getOption("show_onions_compactly"),
     h    = getOption("show_onions_horizontally")
)
comp_names(x)

Arguments

x, object

Onions

comp

Boolean, with TRUE meaning to print onions compactly and any other value to print in matrix form

h

Boolean, with TRUE meaning to print by columns and any other value meaning to print horizontally

Details

Default behaviour is to print by rows. To print by columns, set option show_onions_horizontally to TRUE:

options("show_onions_horizontally" = TRUE)

Any non-TRUE value (including NULL and its being unset) will restore the default.

Similarly, to show onions compactly, set option show_onions_compactly to TRUE:

options("show_onions_compactly" = TRUE)

This option works best for simple onions with integer entries (or at least values with few decimal places), and especially if there are many zero entries.

Function onion_show() is a helper function, not really intended for the end-user.

The “names” of the components of an onion (viz Re, i, j, k for quaternions and Re, i, j, k, l,il,jl,kl for octonions) are given by function comp_names() which takes either a character string or an onion.

Note

The print method for onionmat objects is also sensitive to these options.

Author(s)

Robin K. S. Hankin

Examples



x <- roct(15)
x  #default

options("show_onions_horizontally" = TRUE)
roct(4) 

options("show_onions_horizontally" = FALSE)  # restore default

options("show_onions_compactly" = TRUE)
x <- as.quaternion(matrix(sample(c(0,0,0,-1,1),80,replace=TRUE),4,20))
options("show_onions_compactly" = FALSE) # restore default


RobinHankin/onion documentation built on April 20, 2024, 2:05 p.m.