n2c {cwhmisc} | R Documentation |
n2c
takes a numerical vector or matrix and represents it as
single characters, with legend.
indexLine
generates a string with dots, ";", and digits, usable
as x-label in n2cCompact
: .....;....1....;....2..
n2cCompact
combines n2c
and indexLine
to generate
a vector of strings good for printing numerical matrices.
charMat
processes the output from n2cCompact
and returns
vectors x, y, tx of equal lengths for input to
pltCharMat
n2c(x, symm = FALSE) indexLine(n) n2cCompact(x, symm=FALSE) charMat(cc)
x |
A numerical vector or matrix. |
symm |
If symm = TRUE then upper triangle will be
suppressed. |
n |
integer, length of string wanted |
cc |
output from n2cCompact , input to charMat |
n2c:
Representation of x
as a single-character vector or matrix, as
explained in attribute legend
.
charMat:
list(x,y,txt)
Empty places due to symm = TRUE
are filled with " ".
Christian W. Hoffmann <c-w.hoffmann@sunrise.ch>
http://www.wsl.ch/personal_homepages/hoffmann/index_EN
n2c(c(10e20,-10e5,20,10,0.9,-0.7,0.6,0,-0.5,0.1)) n2c(matrix(c(10e20,10e5,20,10,0.7,0.6,0,0.5,0.1),3,3),FALSE) # [,1] [,2] [,3] # [1,] "X" "1" " " # [2,] "5" "#" "=" # [3,] "1" "*" "," # attr(,"legend") # [1] ">=1: log, >=0. 9& 8% 7# 6* 5= 4+ 3- 2: 1, 05. ' ' " m <- matrix(rnorm(500),nrow=50,ncol=10) n2c(m,symm=TRUE) indexLine(ncol(m)) (n2 <- n2cCompact(m, symm=FALSE)) charMat(n2)