

Arithmetic {base}                            R Documentation

_A_r_i_t_h_m_e_t_i_c _O_p_e_r_a_t_o_r_s

_D_e_s_c_r_i_p_t_i_o_n_:

     These binary operators perform arithmetic on vector
     objects.

_U_s_a_g_e_:

     x + y
     x - y
     x * y
     x / y
     x ^ y
     x %% y
     x %/% y

_D_e_t_a_i_l_s_:

     `1 ^ y' and `y ^ 0' are `1', always.  `x ^ y' should
     also give the proper ``limit'' result when either argu-
     ment is infinite (i.e., `+- Inf').

     Objects such as arrays or time-series can be operated
     on this way provided they are conformable.

_V_a_l_u_e_:

     They return numeric vectors containing the result of
     the element by element operations.  The elements of
     shorter vectors are recycled as necessary.  The opera-
     tors are `+' for addition, `-' for subtraction `*' for
     multiplication, `/' for division and `^' for exponenti-
     ation.

     `%%' indicates `x mod y' and `%/%' indicates integer
     division.  It is guaranteed that `x  ==  (x %% y)  +  y
     * ( x %/% y )' unless `y == 0' where the result is `NA'
     or `NaN' (depending on the `typeof' of the arguments).

_S_e_e _A_l_s_o_:

     `Math' for miscellaneous and `Special' for special
     mathematical functions.

_E_x_a_m_p_l_e_s_:

     x <- -1:12
     x + 1
     2 * x + 3
     x %% 2 #-- is periodic
     x %/% 5

