sign                  package:base                  R Documentation

_S_i_g_n _F_u_n_c_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     'sign' returns a vector with the signs of the corresponding
     elements of 'x' (the sign of a real number is 1, 0, or -1 if the
     number is positive, zero, or negative, respectively).

     Note that 'sign' does not operate on complex vectors.

_U_s_a_g_e:

     sign(x)

_A_r_g_u_m_e_n_t_s:

       x: a numeric vector

_D_e_t_a_i_l_s:

     This is a generic function: methods can be defined for it directly
     or via the 'Math' group generic.

_S_e_e _A_l_s_o:

     'abs'

_E_x_a_m_p_l_e_s:

     sign(pi) # == 1
     sign(-2:3)# -1 -1 0 1 1 1

