pctab                  package:Epi                  R Documentation

_C_r_e_a_t_e _p_e_r_c_e_n_t_a_g_e_s _i_n _a _t_a_b_l_e

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

     Computes percentages and a margin of totals along a given margin
     of a table.

_U_s_a_g_e:

     pctab(TT, margin = length(dim(TT)))

_A_r_g_u_m_e_n_t_s:

      TT: A table or array object

  margin: Which margin should be the the total?

_V_a_l_u_e:

     A table, where all dimensions except the one specified 'margin'
     has two extra levels named "All" (where all entries are 100) and
     "N".

_A_u_t_h_o_r(_s):

     Bendix Carstensen, Steno Diabtes Center, <URL:
     http://www.biostat.ku.dk/~bxc>

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

     'addmargins'

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

     Aye <- sample( c("Yes","Si","Oui"), 177, replace=TRUE )
     Bee <- sample( c("Hum","Buzz"), 177, replace=TRUE )
     Sea <- sample( c("White","Black","Red","Dead"), 177, replace=TRUE )
     A <- table( Aye, Bee, Sea )
     A
     ftable( pctab( A ) )
     ftable( pctab( addmargins( A, 1 ), 3 ) )
     round( ftable( pctab( addmargins( A, 1 ), 3 ), row.vars=3 ), 1)

