These operators compare multiple arrays together, with broadcasting. The underlying functions powering the comparison operators are also exported for use with base R objects.

# S3 method for vctrs_rray
>(e1, e2)

rray_greater(x, y)

# S3 method for vctrs_rray
>=(e1, e2)

rray_greater_equal(x, y)

# S3 method for vctrs_rray
<(e1, e2)

rray_lesser(x, y)

# S3 method for vctrs_rray
<=(e1, e2)

rray_lesser_equal(x, y)

# S3 method for vctrs_rray
==(e1, e2)

rray_equal(x, y)

# S3 method for vctrs_rray
!=(e1, e2)

rray_not_equal(x, y)

Arguments

e1, e2

Generally, the same as x and y. See Details.

x, y

Two vectors, matrices, arrays, or rrays.

Value

The value of the comparison, with dimensions identical to the common dimensions of the inputs.

Details

The comparison operators themselves rely on R's dispatching rules to dispatch to the correct rray comparison operator. When comparing rrays with base R matrices and arrays, this generally works fine. However, if you compare classed objects like factor("x") > rray(1) then a fall through method is used and a warning is thrown. There is nothing we can do about this. See ?groupGeneric for more information on this.

Examples

x <- rray(1:12, c(2, 2, 3)) y <- matrix(1:2) # True except in first 2 positions x > y
#> <rray<lgl>[,2,3][2]> #> , , 1 #> #> [,1] [,2] #> [1,] FALSE TRUE #> [2,] FALSE TRUE #> #> , , 2 #> #> [,1] [,2] #> [1,] TRUE TRUE #> [2,] TRUE TRUE #> #> , , 3 #> #> [,1] [,2] #> [1,] TRUE TRUE #> [2,] TRUE TRUE #>
# All true x >= y
#> <rray<lgl>[,2,3][2]> #> , , 1 #> #> [,1] [,2] #> [1,] TRUE TRUE #> [2,] TRUE TRUE #> #> , , 2 #> #> [,1] [,2] #> [1,] TRUE TRUE #> [2,] TRUE TRUE #> #> , , 3 #> #> [,1] [,2] #> [1,] TRUE TRUE #> [2,] TRUE TRUE #>
# False everywhere x < y
#> <rray<lgl>[,2,3][2]> #> , , 1 #> #> [,1] [,2] #> [1,] FALSE FALSE #> [2,] FALSE FALSE #> #> , , 2 #> #> [,1] [,2] #> [1,] FALSE FALSE #> [2,] FALSE FALSE #> #> , , 3 #> #> [,1] [,2] #> [1,] FALSE FALSE #> [2,] FALSE FALSE #>
# False except in the first 2 positions x <= y
#> <rray<lgl>[,2,3][2]> #> , , 1 #> #> [,1] [,2] #> [1,] TRUE FALSE #> [2,] TRUE FALSE #> #> , , 2 #> #> [,1] [,2] #> [1,] FALSE FALSE #> [2,] FALSE FALSE #> #> , , 3 #> #> [,1] [,2] #> [1,] FALSE FALSE #> [2,] FALSE FALSE #>