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

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

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

                                        Concatenate Strings
                                         连接字符串

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

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

Concatenate vectors after converting to character.
串连后转换为字符的向量。


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


paste(..., sep = " ", collapse = NULL)



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

参数:...
one or more R objects, to be converted to character vectors.
一个或多个R对象,要转换为字符向量。


参数:sep
a character string to separate the terms.  Not NA_character_.
字符串分开的条款。不NA_character_。


参数:collapse
an optional character string to separate the results.  Not NA_character_.
一个可选的字符串,分离的结果。不NA_character_。


Details

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

paste converts its arguments (via as.character) to character strings, and concatenates them (separating them by the string given by sep).  If the arguments are vectors, they are concatenated term-by-term to give a character vector result.  Vector arguments are recycled as needed, with zero-length arguments being recycled to "".
paste将其参数转换(通过as.character)(分离由sep给定的字符串)字符串,并串连。如果参数是向量,他们串联长期由长期给一个特征向量结果。向量参数需要回收,零长度参数被回收到""。

Note that paste() coerces NA_character_, the character missing value, to "NA" which may seem undesirable, e.g., when pasting two character vectors, or very desirable, e.g. in paste("the value of p is ", p).
请注意paste()胁迫NA_character_,字符缺失值,"NA"这可能似乎不可取的,例如,粘贴两个特征向量时,还是非常可取的,如paste("the value of p is ", p)。

If a value is specified for collapse, the values in the result are then concatenated into a single string, with the elements being separated by the value of collapse.
如果为collapse指定一个值,结果值,然后连接成一个字符串,与由collapse值分离的元素。


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

A character vector of the concatenated values.  This will be of length zero if all the objects are, unless collapse is non-NULL in which case it is a single empty string.
一个级联值的特征向量。这将是长度为零,如果所有的对象,除非collapse非NULL,在这种情况下,它是一个单一的空字符串。

If any input into an element of the result is in UTF-8 (and none are declared with encoding "bytes"), that element will be in UTF-8, otherwise in the current encoding in which case the encoding of the element is declared if the current locale is either Latin-1 or UTF-8, at least one of the corresponding inputs (including separators) had a declared encoding and all inputs were either ASCII or declared.
在UTF-8(没有声明编码"bytes")如果有任何输入到一个元素的结果是,该元素将在UTF-8,否则在目前的编码方式,在这种情况下,元素的编码宣布,如果当前的语言环境是为Latin-1或UTF-8,相应的投入(包括分隔)至少有一个声明和所有输入的编码是ASCII或声明。

If an input into an element is declared with encoding "bytes", no translation will be done of any of the elements and the resulting element will have encoding "bytes".  If collapse is non-NULL, this applies also to the second, collapsing, phase, but some translation may have been done in pasting object together in the first phase.
如果输入到一个元素声明与编码"bytes",没有翻译的任何元素和由此产生的元素,将已编码"bytes"。 collapse如果非NULL,这也适用于第二,倒塌,阶段,但有些翻译可能已经一起粘贴在第一阶段的对象。


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

The New S Language. Wadsworth & Brooks/Cole.

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

String manipulation with as.character, substr, nchar, strsplit; further, cat which concatenates and writes to a file, and sprintf for C like string construction.
字符串操作as.character,substr,nchar,strsplit;Ç进一步cat这串连,并写入到一个文件,和sprintf像字串建设。

"plotmath" for the use of paste in plot annotation.
plotmath为paste图注解的使用。


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


paste(1:12) # same as as.character(1:12)[一样as.character(1:12)]
paste("A", 1:6, sep = "")
paste("Today is", date())

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-3 00:45 , Processed in 0.023743 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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