Learn R Programming

rray (version 0.0.0.9000)

rray-compare: Compare arrays

Description

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

Usage

# 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.

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

Run this code
# NOT RUN {
x <- rray(1:12, c(2, 2, 3))
y <- matrix(1:2)

# True except in first 2 positions
x > y

# All true
x >= y

# False everywhere
x < y

# False except in the first 2 positions
x <= y

# }

Run the code above in your browser using DataLab