Elementwise division of numeric or character arrays.

x %div% y

Arguments

x

numeric or character array.

y

numeric or character array.

Value

array.

References

Guidotti E (2022). "calculus: High-Dimensional Numerical and Symbolic Calculus in R." Journal of Statistical Software, 104(5), 1-37. doi:10.18637/jss.v104.i05

See also

Other basic arithmetic: %diff%(), %dot%(), %inner%(), %kronecker%(), %outer%(), %prod%(), %sum%()

Examples

### vector 
x <- c("a+1","b+2")
x %div% x
#> [1] "1" "1"

### matrix 
x <- matrix(letters[1:4], ncol = 2)
x %div% x
#>      [,1] [,2]
#> [1,] "1"  "1" 
#> [2,] "1"  "1" 

### array
x <- array(letters[1:12], dim = c(2,2,3))
y <- array(1:12, dim = c(2,2,3))
x %div% y 
#> , , 1
#> 
#>      [,1]      [,2]     
#> [1,] "(a) / 1" "(c) / 3"
#> [2,] "(b) / 2" "(d) / 4"
#> 
#> , , 2
#> 
#>      [,1]      [,2]     
#> [1,] "(e) / 5" "(g) / 7"
#> [2,] "(f) / 6" "(h) / 8"
#> 
#> , , 3
#> 
#>      [,1]       [,2]      
#> [1,] "(i) / 9"  "(k) / 11"
#> [2,] "(j) / 10" "(l) / 12"
#>