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

