maxCol                 package:base                 R Documentation

_F_i_n_d _M_a_x_i_m_u_m _P_o_s_i_t_i_o_n _i_n _M_a_t_r_i_x

_D_e_s_c_r_i_p_t_i_o_n:

     Find the maximum position for each row of a matrix, breaking ties
     at random.

_U_s_a_g_e:

     max.col(m)

_A_r_g_u_m_e_n_t_s:

       m: numerical matrix

_D_e_t_a_i_l_s:

     Ties are broken at random.  The determination of "tie" assumes
     that the entries are probabilities: there is a relative tolerance
     of 1e-5, relative to the largest entry in the row.

_V_a_l_u_e:

     index of a maximal value for each row, an integer vector of length
     'nrow(m)'.

_R_e_f_e_r_e_n_c_e_s:

     Venables, W. N. and Ripley, B. D. (2002) _Modern Applied
     Statistics with S._ New York: Springer (4th ed).

_S_e_e _A_l_s_o:

     'which.max' for vectors.

_E_x_a_m_p_l_e_s:

     data(swiss)
     table(mc <- max.col(swiss))# mostly "1" and "5", 5 x "2" and once "4"
     swiss[unique(print(mr <- max.col(t(swiss)))) , ] # 3 33 45 45 33 6

