tab1                 package:epicalc                 R Documentation

_O_n_e-_w_a_y _t_a_b_u_l_a_t_i_o_n

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

     One-way tabulation with automatic bar chart

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

     tab1 (x0, decimal = 1, sort.group = c(FALSE, "decreasing", 
     "increasing"), cum.percent = !any(is.na(x0)), graph = TRUE, 
     missing = TRUE, bar.values = c("frequency", "percent", "none"),
     horiz=FALSE) 

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

      x0: a variable

 decimal: number of decimals for the percentage in the table

sort.group: pattern for sorting of categories in the table as in the
          chart. Default is no sorting.

cum.percent: presence of cumulative percentage on the output table.
          Default is TRUE for a variable without any missing value.

   graph: automatic graphing

 missing: include the missing values category or <NA> in the graphic
          display

bar.values: include the value of frequeny, percentage or none at the
          end of each bar

   horiz: set the bar chart to horizontal orientation

_D_e_t_a_i_l_s:

     'tab1' is an advanced one-way tabulation providing a nice table as
     well as a bar chart. The description of the variable is also used
     in the main title of the graph.

     The bar chart is vertical unless the number of categories is more
     than six *and* any of the labels of the levels consists of more
     than 8 characters *or* 'horiz' is set as TRUE.

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

     Output table

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

     Virasakdi Chongsuvivatwong <cvirasak@medicine.psu.ac.th>

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

     'tabpct', 'label.var', 'table', 'barplot'

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

     tab1(state.division)
     tab1(state.division, bar.values ="percent")
     tab1(state.division, sort.group ="decreasing")
     tab1(state.division, sort.group ="increasing")

     data(Oswego)
     use(Oswego)
     tab1(ill) # Note the presence of cumulative percentage on the table.
     tab1(ill, cum.percent=FALSE)
     tab1(chocolate) # Cumulative percentage is automatically off.
     tab1(chocolate, cum.percent=TRUE) # Slightly too many columns!
     tab1(chocolate, missing=FALSE, bar.values="percent")
     agegr <- cut(age, breaks=c(0,20,60,80))
     tab1(agegr)
     tab1(agegr, horiz=TRUE)

