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

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

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

                                        Concatenate and Print
                                         串联和打印

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

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

Outputs the objects, concatenating the representations.  cat performs much less conversion than print.
输出的对象,串联的申述。 cat执行转换比print要少得多。


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


cat(... , file = "", sep = " ", fill = FALSE, labels = NULL,
    append = FALSE)



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

参数:...
R objects (see "Details" for the types of objects allowed).
R对象(见“详细资料”允许的对象类型)。


参数:file
A connection, or a character string naming the file to print to.  If "" (the default), cat prints to the standard output connection, the console unless redirected by sink.  
一个连接,或命名的文件打印到一个字符串。如果""(默认),cat打印到标准输出连接,控制台,除非sink重定向。


参数:sep
a character vector of strings to append after each element.
每个元素后追加一个字符串的字符向量。


参数:fill
a logical or (positive) numeric controlling how the output is broken into successive lines.  If FALSE (default), only newlines created explicitly by "\n" are printed.  Otherwise, the output is broken into lines with print width equal to the option width if fill is TRUE, or the value of fill if this is numeric.  Non-positive fill values are ignored, with a warning.
逻辑或(正)如何打破连续行输出的数字控制。如果FALSE(默认),明确"\n"创建的唯一换行符印制。否则,输出与打印宽度等于期权行打破width如果fill是TRUE或fill如果这是数字的值。非正fill值将被忽略,警告。


参数:labels
character vector of labels for the lines printed. Ignored if fill is FALSE.
标签印刷线的特征向量。如果fill是FALSE忽略。


参数:append
logical. Only used if the argument file is the name of file (and not a connection or "|cmd"). If TRUE output will be appended to file; otherwise, it will overwrite the contents of file.
逻辑。仅用于参数file文件名(不连接或"|cmd")。如果TRUE输出将被附加到file,否则,它会覆盖file内容。


Details

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

cat is useful for producing output in user-defined functions. It converts its arguments to character vectors, concatenates them to a single character vector, appends the given sep= string(s) to each element and then outputs them.
cat是用于产生用户定义的函数输出。将其参数转换特征向量,将其连接到一个单一的特征向量,附加给定的sep=字符串(S)的每个元素,然后输出。

No linefeeds are output unless explicitly requested by "\n" or if generated by filling (if argument fill is TRUE or numeric.)
输出没有换行符,除非明确"\n"或填写所产生的请求(如果参数fill是TRUE或数字。)

If file is a connection and open for writing it is written from its current position.  If it is not open, it is opened for the duration of the call in "wt" mode and then closed again.
file如果是连接,它是从当前位置写书面的开放。如果它是不开放的,它被打开"wt"模式的呼叫的持续时间,然后再次关闭。

Currently only atomic vectors and names are handled, together with NULL and other zero-length objects (which produce no output).  Character strings are output "as is" (unlike print.default which escapes non-printable characters and backslash — use encodeString if you want to output encoded strings using cat).  Other types of R object should be converted (e.g. by as.character or format) before being passed to cat.
目前,只有原子的向量处理和名称,连同NULL和其他零长度的对象(不产生输出)。字符串输出是(不像print.default逃脱非打印字符和反斜杠 - 使用encodeString如果你想输出编码的字符串使用cat)。的其他类型的R对象应转换(如as.character或format)之前被传递到cat。

cat converts numeric/complex elements in the same way as print (and not in the same way as as.character which is used by the S equivalent), so options "digits" and "scipen" are relevant.  However, it uses the minimum field width necessary for each element, rather than the same field width for all elements.
catprint(as.character这是由使用的S相当于以同样的方式)相同的方式转换成数字/复杂的元素,所以options"digits"和"scipen"有关。然而,它使用的最小字段宽度为每个元素所必需的,而不是所有元素都是相同的字段宽度。


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

None (invisible NULL).
无(无形NULL)。


注意----------Note----------

If any element of sep contains a newline character, it is treated as a vector of terminators rather than separators, an element being output after every vector element and a newline after the last.  Entries are recycled as needed.
如果任何sep元素包含换行符,它被视为向量,而不是一个终结分离器,一个元素,每个向量元素后输出,在最后一个换行符。条目需要被回收。


参考文献----------References----------

The New S Language. Wadsworth & Brooks/Cole.

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

print, format, and paste which concatenates into a string.
print,format,paste连接成一个字符串。


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


iter <- stats::rpois(1, lambda=10)
## print an informative message[#打印信息的消息。]
cat("iteration = ", iter <- iter + 1, "\n")

## 'fill' and label lines:[#补和标签行:]
cat(paste(letters, 100* 1:26), fill = TRUE,
    labels = paste("{",1:10,"}:",sep=""))

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-25 03:38 , Processed in 0.022075 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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