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

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

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

                                        Rounding of Numbers
                                         数字的舍入

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

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

ceiling takes a single numeric argument x and returns a numeric vector containing the smallest integers not less than the corresponding elements of x.
ceiling需要一个数字参数x返回一个数字向量的最小整数不超过相应的元素x少。

floor takes a single numeric argument x and returns a numeric vector containing the largest integers not greater than the corresponding elements of x.
floor需要一个数字参数x返回一个数字向量的最大整数不超过x相应的元素。

trunc takes a single numeric argument x and returns a numeric vector containing the integers formed by truncating the values in x toward 0.
trunc需要一个数字参数x返回一个数字的向量,形成了截断值x朝0整数。

round rounds the values in its first argument to the specified number of decimal places (default 0).
round轮在其第一个参数值到指定的小数位数(默认为0)。

signif rounds the values in its first argument to the specified number of significant digits.
signif轮在其第一个参数值的有效位数指定的号码。


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


ceiling(x)
floor(x)
trunc(x, ...)

round(x, digits = 0)
signif(x, digits = 6)



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

参数:x
a numeric vector.  Or, for round and signif, a complex vector.
数字向量。或round和signif,一个复杂的向量。


参数:digits
integer indicating the number of decimal places (round) or significant digits (signif) to be used. Negative values are allowed (see "Details").
整数,表示小数位数(round)(signif)用于有效位数。允许负值(见“详细资料”)。


参数:...
arguments to be passed to methods.
被传递到方法的参数。


Details

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

These are generic functions: methods can be defined for them individually or via the Math group generic.
这些都是通用的功能:方法可以为他们单独或通过Math组通用的定义。

Note that for rounding off a 5, the IEC 60559 standard is expected to be used, "go to the even digit". Therefore round(0.5) is 0 and round(-1.5) is -2.  However, this is dependent on OS services and on representation error (since e.g. 0.15 is not represented exactly, the rounding rule applies to the represented number and not to the printed number, and so round(0.15, 1) could be either 0.1 or 0.2).
请注意,关闭了5位,预计可使用IEC 60559标准,“走出去偶数。因此round(0.5)是0和round(-1.5)是-2。然而,这是OS服务和代表性误差(因为例如0.15没有代表准确,舍入规则适用于代表的数量,而不是印刷数量,所以round(0.15, 1)可以是依赖0.1或0.2)。

Rounding to a negative number of digits means rounding to a power of ten, so for example round(x, digits = -2) rounds to the nearest hundred.
四舍五入到负数的数字四舍五入到十的力量,例如round(x, digits = -2)四舍五入至最接近的百。

For signif the recognized values of digits are 1...22, and non-missing values are rounded to the nearest integer in that range.  Complex numbers are rounded to retain the specified number of digits in the larger of the components.  Each element of the vector is rounded individually, unlike printing.
signif公认的价值观digits是1...22,非缺失值四舍五入到最接近的整数,在这个范围内。复杂的数字均四舍五入保留指定位数,在较大的组件。向量的每个元素是单独圆润,不像印刷。

These are all primitive functions.
这些都是原始功能。


S4方法----------S4 methods----------

These are all (internally) S4 generic.
这些都是所有的(内部)S4通用。

ceiling, floor and trunc are members of the Math group generic.  As an S4 generic, trunc has only one argument.
ceiling,floor和truncMath组成员通用。作为S4通用,trunc只有一个参数。

round and signif are members of the Math2 group generic.
round和signif通用Math2组的成员。


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

The New S Language.  Wadsworth & Brooks/Cole.

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

as.integer.
as.integer。


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


round(.5 + -2:4) # IEEE rounding: -2  0  0  2  2  4  4[IEEE舍入:-2 0 0 2 2 4 4]
( x1 <- seq(-2, 4, by = .5) )
round(x1)#-- IEEE rounding ![ -  IEEE舍入!]
x1[trunc(x1) != floor(x1)]
x1[round(x1) != floor(x1 + .5)]
(non.int <- ceiling(x1) != floor(x1))

x2 <- pi * 100^(-1:3)
round(x2, 3)
signif(x2, 3)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-5-6 06:47 , Processed in 0.025526 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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