interval(sets)
interval()所属R语言包:sets
Intervals
间隔
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Interval class for countable and uncountable numeric sets.
可数和不可数的数字集的区间类。
用法----------Usage----------
interval(l=NULL, r=l,
bounds=c("[]", "[)", "(]", "()", "[[", "]]", "][",
"open", "closed", "left-open", "right-open",
"left-closed", "right-closed"),
domain=NULL)
reals(l=NULL, r=NULL,
bounds=c("[]", "[)", "(]", "()", "[[", "]]", "][",
"open", "closed", "left-open", "right-open",
"left-closed", "right-closed"))
integers(l=NULL, r=NULL)
naturals(l=NULL, r=NULL)
naturals0(l=NULL, r=NULL)
l %..% r
interval_domain(x)
as.interval(x)
integers2reals(x, min=-Inf, max=Inf)
reals2integers(x)
interval_complement(x, y=NULL)
interval_intersection(...)
interval_symdiff(...)
interval_union(...)
interval_difference(...)
interval_division(...)
interval_product(...)
interval_sum(...)
is.interval(x)
interval_contains_element(x, y)
interval_is_bounded(x)
interval_is_closed(x)
interval_is_countable(...)
interval_is_degenerate(x)
interval_is_empty(x)
interval_is_equal(x, y)
interval_is_less_than_or_equal(x, y)
interval_is_less_than(x, y)
interval_is_greater_than_or_equal(x, y)
interval_is_greater_than(x, y)
interval_is_finite(x)
interval_is_half_bounded(x)
interval_is_left_bounded(x)
interval_is_left_closed(x)
interval_is_left_open(...)
interval_is_left_unbounded(x)
interval_measure(x)
interval_is_proper(...)
interval_is_proper_subinterval(x, y)
interval_is_right_bounded(x)
interval_is_right_closed(x)
interval_is_right_open(...)
interval_is_right_unbounded(x)
interval_is_subinterval(x, y)
interval_is_unbounded(x)
interval_is_uncountable(x)
interval_power(x, n)
x %<% y
x %>% y
x %<=% y
x %>=% y
参数----------Arguments----------
参数:x
For as.interval() and is.interval(): an R object. For all other functions: an interval object (or any other R object coercible to one).
对于as.interval()和is.interval():R对象。对于所有其他的功能:的间隔对象(或任何其他的R对象强制转换为1)。
参数:y
An interval object (or any other R object coercible to one).
的间隔对象(或任何其他的R对象强制转换为1)。
参数:min, max
Integers defining the range to be coerced.
整数定义的范围内,被强迫。
参数:l, r
Numeric values defining the bounds of the interval. For integer domains, these will be rounded.
数字值定义的时间间隔的边界。对于整数域,这些将被舍入。
参数:bounds
Character string specifying whether the interval is open, closed, or left/right-open/closed. Symbolic shortcuts such as "()" or "][" for an open interval, etc., are also accepted.
字符串指定的时间间隔是否是开放的,封闭的,或左/右开/常闭。符号的快捷方式,如"()"或"]["一个开放的间隔等,也可以接受。
参数:domain
Character string specifying the domain of the interval: "R", "Z", "N", and "N0" for the reals, integers, positive integers and non-negative integers, respectively. If unspecified, the domain will be guessed from the mode of the numeric values specifying the bounds.
字符串指定的时间间隔域:"R","Z","N"和"N0"为实数,整数,正整数,非负整数,分别。如果未指定,该域名将被猜出的数字值的范围从模式。
参数:n
Integer exponent.
整数指数。
参数:...
Interval objects (or other R objects coercible to interval objects).
间隔对象(或其他R对象转换成间隔对象)。
Details
详细信息----------Details----------
An interval object represents a multi-interval, i.e., a union of disjoint, possibly unbounded (i.e., infinite) ranges of numbers—either the extended reals, or sequences of integers. The usual set operations (union, complement, intersection) and predicates (equality, (proper) inclusion) are implemented. If (numeric) sets and interval objects are mixed, the result will be an interval object. Some basic interval arithmetic operations (addition, subtraction, multiplication, division, power) as well mathematical functions (log, log2, log10, exp, abs, sqrt, trunc, round, floor, ceiling, signif, and the trigonometric functions) are defined. Note that the rounding functions will discretize the interval.
间隔对象表示多间隔,即不相交,工会,可能是无限的(即无限)范围内的数字扩展的实数或整数序列。通常集合运算(并集,补,交叉点)和谓词(平等,(适当的)包含)的贯彻落实。如果集(数字)和间隔对象混合,结果将是一个区间对象。一些基本的区间算术运算(加法,减法,乘法,除法,电力),以及数学函数(log,log2,log10,exp,abs sqrt,trunc,round,floor,ceiling,signif,三角函数)的定义。需要注意的是舍入功能,将离散的时间间隔。
Coercion methods for the as.numeric, as.list, and as.set generics are implemented. reals2integers() discretizes a real multi-interval. integers2reals() returns a multi-interval of corresponding (degenerate) real intervals.
强制as.numeric,as.list和as.set仿制药的方法实现。 reals2integers()离散一个真正的多间隔。 integers2reals()返回一个多区间对应的(退化)真正的时间间隔。
The summary functions min, max, range, sum, mean and prod are implemented and work on the interval bounds.
汇总函数min,max,range,sum,mean和prod的实施和工作的区间边界。
sets_options() allows to change the style of open bounds according to the ISO 31-11 standard using reversed brackets instead of round parentheses (see examples).
sets_options()允许改变风格的开放的范围内,根据使用反转括号,而不是圆括号31-11 ISO标准(见例子)。
值----------Value----------
For the predicates: a logical value. For all other functions:
对于谓词逻辑值。对于所有其他功能:
参见----------See Also----------
set and gset for finite (generalized) sets.
set和gset有限集(广义)。
实例----------Examples----------
#### * general interval constructor[###*一般间隔构造函数]
interval(1,5)
interval(1,5, "[)")
interval(1,5, "()")
## ambiguous notation -> use alternative style[#暧昧的符号 - >使用的另类风格]
sets_options("openbounds", "][")
interval(1,5, "()")
sets_options("openbounds", "()")
interval(1,5, domain = "Z")
interval(1L, 5L)
## degenerate interval[#退化间隔]
interval(3)
## empty interval[#空区间]
interval()
#### * reals[###*雷亚尔]
reals()
reals(1,5)
reals(1,5,"()")
reals(1) ## half-unbounded[#半无界]
## (auto-)complement[#(自动)补]
!reals(1,5)
interval_complement(reals(1,5), reals(2, Inf))
## combine/c(reals(2,4), reals(3,5))[结合雷亚尔(2,4)/ C((3,5),实数)]
reals(2,4) | reals(3,5)
## intersection[#路口]
reals(2,4) & reals(3,5)
## overlapping intervals[#重叠的时间间隔]
reals(2,4) & reals(3,5)
reals(2,4) & reals(4,5,"(]")
## non-overlapping[非重叠]
reals(2,4) & reals(7,8)
reals(2,4) | reals(7,8)
reals(2,4,"[)") | reals(4,5,"(]")
## degenerated cases[#退化的情况下,]
reals(2,4) | interval()
c(reals(2,4), set())
reals(2,4) | interval(6)
c(reals(2,4), set(6), 9)
## predicates[#谓词]
interval_is_empty(interval())
interval_is_degenerate(interval(4))
interval_is_bounded(reals(1,2))
interval_is_bounded(reals(1,Inf)) ## !! FALSE, because extended reals[#! FALSE,因为扩展的实数]
interval_is_half_bounded(reals(1,Inf))
interval_is_left_bounded(reals(1,Inf))
interval_is_right_unbounded(reals(1,Inf))
interval_is_left_closed(reals(1,Inf))
interval_is_right_closed(reals(1,Inf)) ## !! TRUE[#! TRUE]
reals(1,2) <= reals(1,5)
reals(1,2) < reals(1,2)
reals(1,2) <= reals(1,2,"[)")
reals(1,2,"[)") < reals(1,2)
#### * integers[###*整数]
integers()
naturals()
naturals0()
3 %..% 5
integers(3, 5)
integers(3, 5) | integers(6,9)
integers(3, 5) | integers(7,9)
interval_complement(naturals(), integers())
naturals() <= naturals0()
naturals0() <= integers()
## mix reals and integers[#混合实数和整数。]
c(reals(2,5), integers(7,9))
interval_complement(reals(2,5), integers())
interval_complement(integers(2,5), reals())
try(interval_complement(integers(), reals()), silent = TRUE) ## infeasible --> error[#不可行 - >错误]
integers() <= reals()
reals() <= integers()
### interval arithmetic[##间隔算术的]
x <- interval(2,4)
y <- interval(3,6)
x + y
x - y
x * y
x / y
## summary functions[#汇总函数]
min(x, y)
max(y)
range(y)
mean(y)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|