Modified versions of binary operators that support implicit expansion. Arguments are passed to mmapply() with the corresponding element-wise binary operator. For instance, x %m+% y is equivalent to mmapply('+', x, y).

x %m+% y

x %m-% y

x %m*% y

x %m/% y

x %m^% y

x %m==% y

x %m!=% y

x %m>% y

x %m<% y

x %m>=% y

x %m<=% y

x %m|% y

x %m&% y

Arguments

x, y

Arrays or objects that can be coerced to arrays using as.array().

Value

The result of mmapply('XXX', x, y), with XXX replaced by the corresponding element-wise binary operator.

See also

Examples

x <- c(1,2,3)
y <- t(c(4,5))
x %m+% y
#>      [,1] [,2]
#> [1,]    5    6
#> [2,]    6    7
#> [3,]    7    8

m <- matrix(3*(1:12)^2, 3, 4)
cm <- t(colMeans(m))
m %m-% cm
#>      [,1] [,2] [,3] [,4]
#> [1,]  -11  -29  -47  -65
#> [2,]   -2   -2   -2   -2
#> [3,]   13   31   49   67

(1:3) %m>=% t(3:1)
#>       [,1]  [,2] [,3]
#> [1,] FALSE FALSE TRUE
#> [2,] FALSE  TRUE TRUE
#> [3,]  TRUE  TRUE TRUE