margin.table              package:base              R Documentation

_C_o_m_p_u_t_e _t_a_b_l_e _m_a_r_g_i_n

_D_e_s_c_r_i_p_t_i_o_n:

     For a contingency table in array form, compute the sum of table
     entries for a given index.

_U_s_a_g_e:

     margin.table(x, margin=NULL)

_A_r_g_u_m_e_n_t_s:

       x: an array

  margin: index number (1 for rows, etc.) 

_D_e_t_a_i_l_s:

     This is really just 'apply(x, margin, sum)' packaged up for
     newbies, except that if 'margin' has length zero you get 'sum(x)'.

_V_a_l_u_e:

     The relevant marginal table.  The class of 'x' is copied to the
     output table, except in the summation case.

_A_u_t_h_o_r(_s):

     Peter Dalgaard

_E_x_a_m_p_l_e_s:

     m<-matrix(1:4,2)
     margin.table(m,1)
     margin.table(m,2)

