Table                 package:memisc                 R Documentation

_O_n_e-_D_i_m_e_n_s_i_o_n_a_l _T_a_b_l_e _o_f _F_r_e_q_u_e_n_c_e_s _a_n_d/_o_r _P_e_r_c_e_n_t_a_g_e_s

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

     'Table' is a generic function that produces a table of counts or
     weighted counts and/or the corresponding percentages of an atomic
     vector, factor or '"item.vector"' object. This function is
     intended for use with 'aggregate.formula' or 'genTable'. The
     '"item.vector"' method is the workhorse of 'codebook'.

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

     ## S4 method for signature 'atomic':
     Table(x,weights=NULL,counts=TRUE,percentage=FALSE,...)
     ## S4 method for signature 'factor':
     Table(x,weights=NULL,counts=TRUE,percentage=FALSE,...)
     ## S4 method for signature 'item.vector':
     Table(x,weights=NULL,counts=TRUE,percentage=(style=="codebook"),
                   style=c("table","codebook","nolabels"),
                   include.missings=(style=="codebook"),
                   missing.marker=if(style=="codebook") "M" else "*",...)

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

       x: an atomic vector, factor or '"item.vector"' object

  counts: logical value, should the table contain counts?

percentage: logical value, should the table contain percentages? Either
          the 'counts' or the 'percentage' arguments or both should be
          'TRUE'. 

   style: character string, the style of the names or rownames of the
          table.

 weights: a numeric vector of weights of the same length as 'x'.

include.missings: a logical value; should missing values included into
          the table?

missing.marker: a character string, used to mark missing values in the
          table (row)names.

     ...: other, currently ignored arguments.

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

     The atomic vector and factor methods return either a vector of
     counts or vector of percentages or a matrix of counts and
     percentages. The same applies to the '"item.vector"' vector method
     unless 'include.missing=TRUE' and 'percentage=TRUE', in which case
     total percentages and percentages of valid values are given.

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

       with(as.data.frame(UCBAdmissions),Table(Admit,Freq))
       aggregate(Table(Admit,Freq)~.,data=UCBAdmissions)

       A <- sample(c(1:5,9),size=100,replace=TRUE)
       labels(A) <- c(a=1,b=2,c=3,d=4,e=5,dk=9)
       missing.values(A) <- 9
       Table(A,percentage=TRUE)

