找回密码
 注册
查看: 2130|回复: 0

R语言:printSpMatrix()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 17:37:19 | 显示全部楼层 |阅读模式
printSpMatrix(Matrix)
printSpMatrix()所属R语言包:Matrix

                                        Format and Print Sparse Matrices Flexibly
                                         灵活的格式和打印稀疏矩阵

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Format and print sparse matrices flexibly. These are the “workhorses” used by the format, show and print methods for sparse matrices.  If x is large, printSpMatrix2(x) calls printSpMatrix() twice, namely, for the first and the last few rows, suppressing those in between, and also suppresses columns when x is too wide.
灵活的格式和打印稀疏矩阵。这些都是“工作母机”由format使用,show和print稀疏矩阵的方法。 x如果大printSpMatrix2(x)要求printSpMatrix()两次,分别为第一和最后几行,压制之间,并抑制列时x太宽。

printSpMatrix() basically prints the result of formatSpMatrix().
printSpMatrix()基本上打印formatSpMatrix()的结果。


用法----------Usage----------


formatSpMatrix(x, digits = NULL, maxp = 1e9,
               cld = getClassDef(class(x)), zero.print = ".",
               col.names, note.dropping.colnames = TRUE,
               align = c("fancy", "right"))

printSpMatrix(x, digits = NULL, maxp = getOption("max.print"),
              cld = getClassDef(class(x)),
              zero.print = ".", col.names, note.dropping.colnames = TRUE,
              col.trailer = "",
              align = c("fancy", "right"))

printSpMatrix2(x, digits = NULL, maxp = getOption("max.print"),
              zero.print = ".", col.names, note.dropping.colnames = TRUE,
              suppRows = NULL, suppCols = NULL,
              col.trailer = if(suppCols) "......" else "",
              align = c("fancy", "right"))



参数----------Arguments----------

参数:x
an R object inheriting from class sparseMatrix.
继承类sparseMatrixR对象。


参数:digits
significant digits to use for printing, see print.default, the default, NULL, corresponds to using getOption("digits").
用于打印的有效位数,看到print.default,默认情况下,NULL,对应使用getOption("digits")。


参数:maxp
integer, default from options(max.print), influences how many entries of large matrices are printed at all.
整数,默认情况下从options(max.print),影响大矩阵的许多项目都印在所有。


参数:cld
the class definition of x; must be equivalent to getClassDef(class(x)) and exists mainly for possible speedup.
x类定义;必须相当于getClassDef(class(x))“主要存在可能的加速。


参数:zero.print
character which should be printed for structural zeroes.  The default "." may occasionally be replaced by " " (blank); using "0" would look almost like print()ing of non-sparse matrices.
应印有字符其中结构零。有时可能会被替换默认"."" "(空);使用"0"看起来几乎像print()ING非稀疏矩阵。


参数:col.names
logical or string specifying if and how column names of x should be printed, possibly abbreviated.  The default is taken from options("sparse.colnames") if that is set, otherwise FALSE unless there are less than ten columns.  When TRUE the full column names are printed.<br> When col.names is a string beginning with "abb" or "sub" and ending with an integer n (i.e., of the form "abb... <n>"), the column names are abbreviate()d or substring()ed to (target) length n, see the examples.  
逻辑或字符串指定如何x应印,可能略列名。默认取自options("sparse.colnames")如果设置,否则FALSE除非有不少于10列。当TRUE全列名被打印出来。参考当col.names与"abb"或"sub"和整数n(即结束字符串的开头的形式"abb... <n>"),列名是abbreviate()Dsubstring()(目标)的长度n,看到的例子。


参数:note.dropping.colnames
logical specifying, when col.names is FALSE if the dropping of the column names should be noted, TRUE by default.
指定的逻辑,当col.names是FALSE如果投掷的列名应指出,TRUE默认情况下。


参数:col.trailer
a string to be appended to the right of each column; this is typically made use of by show(<sparseMatrix>) only, when suppressing columns.
一个被追加到每列右侧的字符串,这通常是由show(<sparseMatrix>),抑制列时使用。


参数:suppRows, suppCols
logicals or NULL, for printSpMatrix2() specifying if rows or columns should be suppressed in printing.  If NULL, sensible defaults are determined from dim(x) and options(c("width", "max.print")). Setting both to FALSE may be a very bad idea.
逻辑值或NULL,printSpMatrix2()如果指定的行或列,应在印刷抑制。如果NULL,合理的默认值,确定dim(x)和options(c("width", "max.print"))。同时设置FALSE可能是一个非常糟糕的主意。


参数:align
a string specifying how the zero.print codes should be aligned, i.e., padded as strings.  The default, "fancy", takes some effort to align the typical zero.print = "." with the position of 0, i.e., the first decimal (one left of decimal point) of the numbers printed, whereas align = "right" just makes use of print(*, right = TRUE).  
一个字符串,指定如何应对准zero.print代码,即填充字符串。默认情况下,"fancy",需要一些努力使典型zero.print = "."0,即印刷的数字,第一位小数(小数点左边)的位置,而 align = "right"print(*, right = TRUE)使用。


Details

详情----------Details----------

If x is large, only the first rows making up the approximately first maxp entries is used, otherwise all of x. .formatSparseSimple() is applied to (a dense version of) the matrix.  Then, formatSparseM is used, unless
如果x是大的,只有第一行约第一maxp项被使用,否则所有x。 .formatSparseSimple()(一片茂密的版本)的矩阵。然后,formatSparseM使用,除非


值----------Value----------


参数:formatSpMatrix()
returns a character matrix with possibly empty column names, depending on col.names etc, see above.
可能是空的列名返回一个字符矩阵,根据col.names等,见上面。


参数:printSpMatrix*()
return x invisibly, see invisible.
返回x看不见的,看见invisible。


作者(S)----------Author(s)----------


Martin Maechler



参见----------See Also----------

the virtual class sparseMatrix and the classes extending it;  maybe sparseMatrix or spMatrix as simple constructors of such matrices.
虚拟类sparseMatrix和扩大它的类;也许sparseMatrix或spMatrix这类矩阵的简单构造。

The underlying utilities formatSparseM and .formatSparseSimple() (on the same page).
formatSparseM和.formatSparseSimple()(在同一页上)基础事业。


举例----------Examples----------


f1 <- gl(5, 3, labels = LETTERS[1:5])
X <- as(f1, "sparseMatrix")
X ## &lt;==&gt;  show(X)  &lt;==&gt;  print(X)[#<==>显示(x)<==>打印(十)]
t(X) ## shows column names, since only 5 columns[#显示,因为只有5列的列名,]

X2 <- as(gl(12, 3, labels = paste(LETTERS[1:12],"c",sep=".")),
         "sparseMatrix")
X2
## less nice, but possible:[#不太好,但可能:]
print(X2, col.names = TRUE) # use [,1] [,2] .. =&gt; does not fit[使用[1] [2] .. =>不适合]

t(X2) # suppressing column names[压制的列名]
print(t(X2), col.names=TRUE)
print(t(X2), zero.print = "", col.names="abbr. 1")
print(t(X2), zero.print = "-", col.names="substring 2")



转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-22 23:44 , Processed in 0.021714 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表