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

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

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

                                        Character Vectors
                                         特征向量

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

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

Create or test for objects of type "character".
创建或测试类型"character"的对象。


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


character(length = 0)
as.character(x, ...)
is.character(x)



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

参数:length
A non-negative integer specifying the desired length. Double values will be coerced to integer: supplying an argument of length other than one is an error.
一个非负整数,指定所需的长度。 Double值将被强制转换为整数:提供一个长度超过一个其他的说法是错误的。


参数:x
object to be coerced or tested.
反对被强迫或测试。


参数:...
further arguments passed to or from other methods.
通过进一步的论据或其他方法。


Details

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

as.character and is.character are generic: you can write methods to handle specific classes of objects, see InternalMethods.  Further, for as.character the default method calls as.vector, so dispatch is first on methods for as.character and then for methods for as.vector.
as.character和is.character是通用的:你可以写的方法来处理特定的类的对象,看到InternalMethods。此外,as.character默认方法调用as.vector,所以调度是第一as.character然后as.vector的方式方法。

as.character represents real and complex numbers to 15 significant digits (technically the compiler's setting of the ISO C constant DBL_DIG, which will be 15 on machines supporting IEC60559 arithmetic according to the C99 standard).  This ensures that all the digits in the result will be reliable (and not the result of representation error), but does mean that conversion to character and back to numeric may change the number.  If you want to convert numbers to character with the maximum possible precision, use format.
as.character15个有效位数(技术上的ISO C编译器的设置不变DBL_DIG,这将是根据C99标准支持IEC60559算术的机器15)表示实数和复数。这将确保所有的数字结果将是可靠的(而不是代表错误的结果),但并不意味着转换字符为数字,可能会改变数字。如果你想最大可能精度的数字转换为字符,请使用format。


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

character creates a character vector of the specified length. The elements of the vector are all equal to "".
character创建一个指定长度的字符向量。向量的元素都是平等""。

as.character attempts to coerce its argument to character type; like as.vector it strips attributes including names. For lists it deparses the elements individually, except that it extracts the first element of length-one character vectors.
as.character试图强迫其字符类型的参数,如as.vector剥离包括姓名属性。对于列表,它deparses单独的元素,但它提取的第一个元素的长度为一个字符向量。

is.character returns TRUE or FALSE depending on whether its argument is of character type or not.
is.character返回TRUE或FALSE取决于它的参数是否是字符类型或不。


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

as.character truncates components of language objects to 500 characters (was about 70 before 1.3.1).
as.character截断语言对象的组件500个字符(约前70 1.3.1)。


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

The New S Language. Wadsworth & Brooks/Cole.

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

paste, substr and strsplit for character concatenation and splitting, chartr for character translation and casefolding (e.g., upper to lower case) and sub, grep etc for string matching and substitutions.  Note that help.search(keyword = "character") gives even more links.
paste,substr和strsplit字符串联和分裂的,chartr字符翻译和casefolding的(例如,上层为小写)和sub,grep字符串匹配和替换等。注意help.search(keyword = "character")提供更多的链接。

deparse, which is normally preferable to as.character for language objects.
deparse,这是通常最好as.character语言对象。


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


form <- y ~ a + b + c
as.character(form)  ## length 3[#长度为3]
deparse(form)       ## like the input[#如输入]

a0 &lt;- 11/999          # has a repeating decimal representation[有一个重复的十进制表示形式]
(a1 <- as.character(a0))
format(a0, digits=16) # shows one more digit[显示了一个多位数]
a2 <- as.numeric(a1)
a2 - a0               # normally around -1e-17[通常约-1E-17]
as.character(a2)      # normally different from a1[通常不同,从A1]
print(c(a0, a2), digits = 16)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-3 03:45 , Processed in 0.028814 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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