pmax.sa {sfsmisc} | R Documentation |
These are versions of pmax
and pmin
which return (more-dimensional) arrays.
pmax.sa(scalar, arr) pmin.sa(scalar, arr)
scalar |
numeric scalar. |
arr |
any numeric R object, typically array. |
an array with the same dim
and dimnames
as
the input arr
.
Martin Maechler
pmin
.
m <- cbind(a=1:5, b=3:7, c=-2:2) pmax (3, m) # < dropping all attributes pmax.sa(3, m) # matrix with dimnames ## no "added value" for simple case: x <- rpois(20, 7) stopifnot(identical(pmin (2.1, x), pmin.sa(2.1, x)), identical(pmax (2.1, 3), pmax.sa(2.1, 3)))