Extremes(base)
Extremes()所属R语言包:base
Maxima and Minima
最大值与最小值
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Returns the (parallel) maxima and minima of the input values.
返回(水货)输入值最大值和最小值。
用法----------Usage----------
max(..., na.rm = FALSE)
min(..., na.rm = FALSE)
pmax(..., na.rm = FALSE)
pmin(..., na.rm = FALSE)
pmax.int(..., na.rm = FALSE)
pmin.int(..., na.rm = FALSE)
参数----------Arguments----------
参数:...
numeric or character arguments (see Note).
数字或字符的论点(见注)。
参数:na.rm
a logical indicating whether missing values should be removed.
逻辑指示是否应删除缺失值。
Details
详情----------Details----------
max and min return the maximum or minimum of all the values present in their arguments, as integer if all are logical or integer, as double if all are numeric, and character otherwise.
max和min返回他们的论据中存在的所有值的最大值或最小值,作为integer如果都是logical或integer,<X >如果全部是数字,字符,否则。
If na.rm is FALSE an NA value in any of the arguments will cause a value of NA to be returned, otherwise NA values are ignored.
如果na.rm是FALSENA中的任何参数值将导致一个NA要返回的值,否则NA值将被忽略。
The minimum and maximum of a numeric empty set are +Inf and -Inf (in this order!) which ensures transitivity, e.g., min(x1, min(x2)) == min(x1, x2). For numeric x max(x) == -Inf and min(x) == +Inf whenever length(x) == 0 (after removing missing values if requested). However, pmax and pmin return NA if all the parallel elements are NA even for na.rm = TRUE.
数字空集的最小和最大+Inf和-Inf(这个顺序!),确保传递,例如,min(x1, min(x2)) == min(x1, x2)。对于数字xmax(x) == -Inf和min(x) == +Inf时length(x) == 0(如果要求删除遗漏值后)。然而,pmax和pmin回NA如果所有平行的元素是NA甚至na.rm = TRUE。
pmax and pmin take one or more vectors (or matrices) as arguments and return a single vector giving the "parallel" maxima (or minima) of the vectors. The first element of the result is the maximum (minimum) of the first elements of all the arguments, the second element of the result is the maximum (minimum) of the second elements of all the arguments and so on. Shorter inputs (of non-zero length) are recycled if necessary. Attributes (see attributes: such as names or dim) are copied from the first argument (if applicable).
pmax和pmin一个或多个向量(或矩阵)作为参数并返回一个单一的向量,让水货的极大(或极小)向量。结果的第一个元素是所有参数的第一要素的最大(最小),结果第二个元素是最大(最小)的第二个元素的所有参数等。如有必要,较短的输入(非零长度)被回收。属性(见attributes:names或dim)从复制的第一个参数(如适用)。
pmax.int and pmin.int are faster internal versions only used when all arguments are atomic vectors and there are no classes: they drop all attributes. (Note that all versions fail for raw and complex vectors since these have no ordering.)
pmax.int和pmin.int更快的内部版本仅用于当所有参数都是原子的向量,有没有类:他们放弃所有的属性。 (请注意,所有版本的原材料和复杂的向量失败,因为这些都没有订购。)
max and min are generic functions: methods can be defined for them individually or via the Summary group generic. For this to work properly, the arguments ... should be unnamed, and dispatch is on the first argument.
max和min是通用的功能:可以定义为他们单独或通过Summary组通用方法。对于这个正常工作,...应该是命名,并派遣第一个参数是参数。
By definition the min/max of a numeric vector containing an NaN is NaN, except that the min/max of any vector containing an NA is NA even if it also contains an NaN. Note that max(NA, Inf) == NA even though the maximum would be Inf whatever the missing value actually is.
根据定义的最大/最小的一个数字包含向量NaN是NaN,除了任何包含NA向量的最大/最小是NA即使它也包含NaN。注意max(NA, Inf) == NA即使最大的将是Inf任何遗漏值实际上是。
Character versions are sorted lexicographically, and this depends on the collating sequence of the locale in use: the help for "Comparison" gives details. The max/min of an empty character vector is defined to be character NA. (One could argue that as "" is the smallest character element, the maximum should be "", but there is no obvious candidate for the minimum.)
字符版本的字典进行排序,这取决于所使用的语言环境的整理顺序:比较帮助提供更多的细节。一个空的字符向量的最大/分钟被定义为字符NA。 (有人可能会说""是最小的字符元素,最大的应该是"",但没有明显的候选人的最低。)
值----------Value----------
For min or max, a length-one vector. For pmin or pmax, a vector of length the longest of the input vectors.
对于min或max,长度的一个向量。对于pmin或pmax,向量的长度最长的输入向量。
The type of the result will be that of the highest of the inputs in the hierarchy integer < real < character.
结果将是最高层次结构中的整数<真正的<字符输入。
For min and max if there are only numeric inputs and all are empty (after possible removal of NAs), the result is double (Inf or -Inf).
min和max如果只有数字输入,一切都是空的(NA的可能搬迁后),其结果是双(Inf或-Inf )。
S4方法----------S4 methods----------
max and min are part of the S4 Summary group generic. Methods for them must use the signature x, ..., na.rm.
max和min的S4Summary组通用的一部分。他们的方法必须使用签名x, ..., na.rm。
注意----------Note----------
"Numeric" arguments are vectors of type integer and numeric, and logical (coerced to integer). For historical reasons, NULL is accepted as equivalent to integer(0).
“数字”的参数是整数类型(强制转换为整数),数字和逻辑的向量。由于历史的原因,NULL被接纳为等同integer(0)。
pmax and pmin will also work on classed objects with appropriate methods for comparison, is.na and rep (if recycling of arguments is needed).
pmax和pmin也将使用适当的方法进行比较归类对象,is.na和rep(如果需要参数的回收)。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
参见----------See Also----------
range (both min and max) and which.min (which.max) for the arg min, i.e., the location where an extreme value occurs.
range(min和max)和which.min(which.max)为arg的最小,即一个极端值出现的位置。
"plotmath" for the use of min in plot annotation.
plotmath为min图注解的使用。
举例----------Examples----------
require(stats); require(graphics)
min(5:1, pi) #-> one number[ - >一个数字]
pmin(5:1, pi) #-> 5 numbers[ - > 5个号码]
x <- sort(rnorm(100)); cH <- 1.35
pmin(cH, quantile(x)) # no names[没有名字]
pmin(quantile(x), cH) # has names[有名字]
plot(x, pmin(cH, pmax(-cH, x)), type='b', main= "Huber's function")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|