symnum {base} | R Documentation |
Symbolically encode a given numeric or logical vector or array.
symnum(x, cutpoints=c(0.3, 0.6, 0.8, 0.9, 0.95),
symbols=c(" ", ".", ",", "+", "*", "B"),
legend = length(symbols) >= 3,
na="?", eps=1e-5,
corr = missing(cutpoints), show.max = if(corr) "1", show.min = NULL,
lower.triangular = corr & is.matrix(x),
diag.lower.tri = corr & !is.null(show.max))
x |
numeric or logical vector or array. |
cutpoints |
numeric vector whose values |
symbols |
character vector, one shorter than (the
augmented, see For |
legend |
logical indicating if a |
na |
character or logical. How |
eps |
absolute precision to be used at left and right boundary. |
corr |
logical. If |
show.max |
If |
show.min |
If |
lower.triangular |
logical. If |
diag.lower.tri |
logical. If |
An atomic character object of class noquote
and the same
dimensions as x
.
If legend
(TRUE
by default when there more than 2 classes),
it has an attribute "legend"
containing a legend
of the returned character codes, in the form
c_1 s_1 c_2 s_2 \dots s_n c_{n+1}
where c_j
= cutpoints[j]
and
s_j
= symbols[j]
.
Martin Maechler maechler@stat.math.ethz.ch
as.character
ii <- 0:8; names(ii) <- ii
symnum(ii, cut= 2*(0:4), sym = c(".", "-", "+", "$"))
symnum(ii, cut= 2*(0:4), sym = c(".", "-", "+", "$"), show.max=TRUE)
symnum(1:12 %% 3 == 0)# use for logical
##-- Symbolic correlation matrices:
data(attitude)
symnum(cor(attitude), diag = FALSE)
symnum(cor(rbind(1, rnorm(25), rnorm(25)^2)))
symnum(cor(matrix(rexp(30, 1), 5, 18))) # <<-- PATTERN ! --
symnum(cm1 <- cor(matrix(rnorm(90) , 5, 18))) # < White Noise SMALL n
symnum(cm1, diag=FALSE)
symnum(cm2 <- cor(matrix(rnorm(900), 50, 18))) # < White Noise "BIG" n
symnum(cm2, lower=FALSE)
## NA's:
Cm <- cor(matrix(rnorm(60), 10, 6)); Cm[c(3,6), 2] <- NA
symnum(Cm, show.max=NULL)
## Graphical P-values (aka "significance stars"):
pval <- rev(sort(c(outer(1:6, 10^-(1:3)))))
symp <- symnum(pval, corr=FALSE,
cutpoints = c(0, .001,.01,.05, .1, 1),
symbols = c("***","**","*","."," "))
noquote(cbind(P.val = format(pval), Signif= symp))