symnum(stats)
symnum()所属R语言包:stats
Symbolic Number Coding
符号数编码
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Symbolically encode a given numeric or logical vector or array. Particularly useful for visualization of structured matrices, e.g., correlation, sparse, or logical ones.
象征性地给定的数字或逻辑向量或数组编码。特别有用的矩阵结构,例如,相关性,稀疏,或逻辑的可视化。
用法----------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-5, 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
numeric or logical vector or array.
数字或逻辑向量或数组。
参数:cutpoints
numeric vector whose values cutpoints[j] == c[j] (after augmentation, see corr below) are used for intervals.
数值向量,其值cutpoints[j] == c[j](隆胸后,看到corr以下)的使用间隔。
参数:symbols
character vector, one shorter than (the augmented, see corr below) cutpoints. symbols[j] == s[j] are used as "code" for the (half open) interval (c[j], c[j+1]]. When numeric.x is FALSE, i.e., by default when argument x is logical, the default is c(".","|") (graphical 0 / 1 s).
特征向量,比短(增强,看到corr以下)cutpoints。的symbols[j]“ == s[j]使用”代码“(半开)区间(c[j], c[j+1]]。当numeric.x是FALSE,即,时默认参数x是logical,默认是c(".","|")(图形0/1)。
参数:legend
logical indicating if a "legend" attribute is desired.
逻辑表示如果"legend"属性所需。
参数:na
character or logical. How NAs are coded. If na == FALSE, NAs are coded invisibly, including the "legend" attribute below, which otherwise mentions NA coding.
字符或逻辑。如何NAs编码。如果na == FALSE,NA的是看不见的编码,包括"legend"属性下面,否则提到无编码。
参数:eps
absolute precision to be used at left and right boundary.
绝对精度,可用于在左边和右边的边界。
参数:numeric.x
logical indicating if x should be treated as numbers, otherwise as logical.
逻辑x如果应为数字处理,否则为逻辑。
参数:corr
logical. If TRUE, x contains correlations. The cutpoints are augmented by 0 and 1 and abs(x) is coded.
逻辑。如果TRUE,x包含相关。的切点是增加0和1和abs(x)编码。
参数:show.max
if TRUE, or of mode character, the maximal cutpoint is coded especially.
如果TRUE,或模式character,最大的分割点编码,尤其是。
参数:show.min
if TRUE, or of mode character, the minimal cutpoint is coded especially.
如果TRUE,或模式character,最小的分割点编码,尤其是。
参数:abbr.colnames
logical, integer or NULL indicating how column names should be abbreviated (if they are); if NULL (or FALSE and x has no column names), the column names will all be empty, i.e., ""; otherwise if abbr.colnames is false, they are left unchanged. If TRUE or integer, existing column names will be abbreviated to abbreviate(*, minlength = abbr.colnames).
如果NULL(NULL和FALSE有没有列名),列名的逻辑,整数或x说明如何列名应缩写(如果有的话);都将是空的,也就是说,""; abbr.colnames否则,如果是假的,他们都保持不变。如果TRUE或整数,现有的列名缩写abbreviate(*, minlength = abbr.colnames)。
参数:lower.triangular
logical. If TRUE and x is a matrix, only the lower triangular part of the matrix is coded as non-blank.
逻辑。如果TRUE和x是一个矩阵,只有较低的三角矩阵编码非空白。
参数:diag.lower.tri
logical. If lower.triangular and this are TRUE, the diagonal part of the matrix is shown.
逻辑。如果lower.triangular这是TRUE,矩阵对角线部分所示。
值----------Value----------
An atomic character object of class noquote and the same dimensions as x.
类noquote和x尺寸相同的原子字符对象。
If legend is TRUE (as by default when there are more than two classes), the result has an attribute "legend" containing a legend of the returned character codes, in the form
如果legend是TRUE(默认情况下,当有超过两个班),结果在表格属性"legend"包含返回的字符代码的一个传奇,
where c[j] = cutpoints[j] and s[j] = symbols[j].
其中c[j]“ = cutpoints[j]和s[j]” = symbols[j]。
注意----------Note----------
The optional (mostly logical) arguments all try to use smart defaults. Specifying them explicitly may lead to considerably improved output in many cases.
可选参数(主要是逻辑)都尝试使用智能的默认。明确指定它们可能会导致在许多情况下的输出大大改善。
作者(S)----------Author(s)----------
Martin Maechler <a href="mailto:maechler@stat.math.ethz.ch">maechler@stat.math.ethz.ch</a>
参见----------See Also----------
as.character; image
as.characterimage
举例----------Examples----------
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)# --> "|" = TRUE, "." = FALSE for logical[ - >“”“”= TRUE时, = FALSE的逻辑]
## Pascal's Triangle modulo 2 -- odd and even numbers:[#帕斯卡的三角模2 - 奇数和偶数:]
N <- 38
pascal <- t(sapply(0:N, function(n) round(choose(n, 0:N - (N-n)%/%2))))
rownames(pascal) <- rep("", 1+N) # <-- to improve "graphic"[< - 提高“图形”]
symnum(pascal %% 2, symbols = c(" ", "A"), numeric = FALSE)
##-- Symbolic correlation matrices:[# - 符号相关矩阵:]
symnum(cor(attitude), diag = FALSE)
symnum(cor(attitude), abbr.= NULL)
symnum(cor(attitude), abbr.= FALSE)
symnum(cor(attitude), abbr.= 2)
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[<白噪音小N]
symnum(cm1, diag=FALSE)
symnum(cm2 <- cor(matrix(rnorm(900), 50, 18))) # < White Noise "BIG" n[<白噪音“大”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"):[#图形P值(又名“的意义之星”):]
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))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|