symnum
Symbolic Number Coding

Description

Encode ranges of numbers as symbols for compact printouts.

Usage

symnum(x, cutpoints = c(0.3, 0.6, 0.8, 0.9, 0.95),
        symbols = if (numeric.x) c(" ", ".", ",", "+", "*", "B") else c(".", "|"),
	legend = length(symbols) >= 3, na = "?", eps = 1e-05, numeric.x = is.numeric(x),
	corr = missing(cutpoints) && numeric.x, show.max = if (corr) "1", show.min = NULL,
	abbr.colnames = has.colnames, lower.triangular = corr && is.numeric(x) && is.matrix(x),
	diag.lower.tri = corr && !is.null(show.max))

Arguments

x a numeric or logical vector, matrix or array. NAs are accepted.
cutpoints a numeric vector of cut points (without duplicates) to specify the intervals. If corr is TRUE, the cutpoints must be between of 0 and 1 (exclusive), and are extended with 0 and 1. The range of the possibly extended cutpoints vector must cover the range of x (or abs(x) if corr is TRUE).
symbols a character vector of symbols corresponding to the intervals between the possibly extended cutpoints (for numeric x) or to FALSE and TRUE, respectively (for logical x).
legend a logical value. If TRUE, an attribute "legend" is returned in the result.
na a character string to represent missing values in x. If NULL, then NAs are symbolized with the empty string and the legend does not mention NAs.
eps a number to specify the tolerance of precision. eps is used to check the left and right boundary of cutpoints when the show.min or show.max arguments are used.
numeric.x a logical value to specify whether x is numeric.
show.max can be one of the following:
  • a character string representing a special symbol for those elements of x equal to the maximum of cutpoints.
  • a logical TRUE if the the maximum of cutpoints is formatted (without decimal) as this special symbol.
  • a logical FALSE and NULL if there is no special symbol for this case.
show.min can be one of the following:
  • a character string representing a special symbol for those elements of x equal to the minimum of cutpoints.
  • a logical TRUE if the minimum of cutpoints is formated (without decimal) as this special symbol.
  • a logical FALSE and NULL if there is no special symbol for this case.
corr a logical value to indicate if x contains correlations. If TRUE, then x is treated as abs(x), and 0 and 1 are added to the vector of cutpoints.
abbr.colnames a logical, an integer, or NULL specifying the way to abbreviate column names.
lower.triangular a logical value to indicate that the upper triangle of a matrix output should be encoded as emtpy strings. It is valid only when x is a matrix. If TRUE, the upper triangle of the matrix is symbolized with the empty string (therefore it is not shown). If FALSE, the entire matrix of is encoded.
diag.lower.tri a logical value used only when lower.triangular is TRUE. If TRUE, the diagonals are encoded as symbols; otherwise, they are encoded by empty strings.
Value
returns an object of class "noquote" with the same dimension as x, possibly with an attribute called "legend".
See Also
format, cut, noquote
Examples
symnum(cor(Sdatasets::state.x77))
symnum(outer(sin(1:9), seq(-1, .5, by=1/4), `>`), symbols=c(".", "+"))
Package stats version 6.1.1-7
Package Index