rray_pmax()computes the elementwise maximum of two arrays.rray_pmin()computes the elementwise minimum of two arrays.
Details
The arrays are broadcast to common dimensions first, so they do not have to be the same shape.
When NA and NaN are both present, NA wins, like rray_max(),
rray_min(), max(), and min(). This differs from pmax() and pmin(),
which return whichever comes last:
Examples
x <- array(1:6, c(3L, 2L))
rray_pmax(x, 4L)
#> [,1] [,2]
#> [1,] 4 4
#> [2,] 4 5
#> [3,] 4 6
rray_pmin(x, 4L)
#> [,1] [,2]
#> [1,] 1 4
#> [2,] 2 4
#> [3,] 3 4
# Compare each column with a different value through broadcasting
rray_pmax(x, array(c(2L, 5L), c(1L, 2L)))
#> [,1] [,2]
#> [1,] 2 5
#> [2,] 2 5
#> [3,] 3 6
