bdVector
s.
pmax(..., na.rm=F) pmin(..., na.rm=F)
bdNumeric
s.
Missing values (NA) are allowed.
bdVector
whose first element is the maximum (
pmax
) or
minimum (
pmin
) of the first elements of the arguments, and
similarly for the second element, etc. The length of the
vector or
bdVector
is the length of the longest argument. Shorter
vectors or
bdVector
s are re-used cyclically.
If the first argument is longest, then the result will have the
attributes of the first argument.
If an element of any of the arguments is
NA
, the
corresponding element of the result is also
NA
unless
na.rm=TRUE
.
The maximum or minimum is found of the non-missing values when
na.rm=TRUE
.
Note the difference between
pmax
,
pmin
and
max
,
min
. The
latter two give the single element which is the maximum or minimum of all the
arguments.
z <- pmax(x, y, 5) # vector as long as larger of x and y # where z[i] is max of x[i], y[i], and 5 z <- pmax(x, y, 5, na.rm=T) # as above but missing values are ignored