%+-% {dipsaus}R Documentation

Plus-minus operator

Description

Plus-minus operator

Usage

a %+-% b

Arguments

a, b

numeric vectors, matrices or arrays

Value

a +/- b, the dimension depends on a+b. If a+b is a scalar, returns a vector of two; in the case of vector, returns a matrix; all other cases will return an array with the last dimension equal to 2.

Examples


# scalar
1 %+-% 2   # -1, 3

# vector input
c(1,2,3) %+-% 2   # matrix

# matrix input
matrix(1:9, 3) %+-% 2   # 3x3x2 array


[Package dipsaus version 0.2.8 Index]