Learn R Programming

sfsmisc (version 1.1-0)

pmax.sa: Parallel Maxima / Minima (Scalar, Array)

Description

These are versions of pmax and pmin which return (more-dimensional) arrays.

Usage

pmax.sa(scalar, arr)
pmin.sa(scalar, arr)

Arguments

scalar

numeric scalar.

arr

any numeric R object, typically array.

Value

an array with the same dim and dimnames as the input arr.

See Also

pmin.

Examples

Run this code
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)))

Run the code above in your browser using DataLab