rray-compare: Compare arrays

Description Usage Arguments Details Value Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## S3 method for class 'vctrs_rray'
e1 > e2

rray_greater(x, y)

## S3 method for class 'vctrs_rray'
e1 >= e2

rray_greater_equal(x, y)

## S3 method for class 'vctrs_rray'
e1 < e2

rray_lesser(x, y)

## S3 method for class 'vctrs_rray'
e1 <= e2

rray_lesser_equal(x, y)

## S3 method for class 'vctrs_rray'
e1 == e2

rray_equal(x, y)

## S3 method for class '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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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

rray documentation built on July 23, 2019, 5:04 p.m.