plotmeans              package:gregmisc              R Documentation

_P_l_o_t _G_r_o_u_p _M_e_a_n_s _a_n_d _C_o_n_f_i_d_e_n_c_e _I_n_t_e_r_v_a_l_s

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

     Plot group means and confidence intervals.

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

     plotmeans(formula, data=NULL, subset, na.action,
               bars=T, p=0.95, xlab=names(mf)[2],
               ylab=names(mf)[1], mean.labels=F,
               ci.label=F, n.label=T, digits=getOption("digits"),
               col="black", barwidth=1, barcol="blue",
               connect=T, ccol=col, legends=names(means), ...)

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

 formula: symbolic expression specifying the outcome and grouping
          variable.  See lm() for details.

    data: optional data frame containing the variables in the model.

  subset: an optional vector specifying a subset of observations to be
          used in the fitting process.

na.action: a function which indicates what should happen when the data
          contain `NA's.  See lm() for details. 

    bars: a logical value indicating whether confidence interval bars
          should be plotted. Defaults to TRUE.

       p: confidence level for error bars.  Defaults to 0.95.

    xlab: x-axis label.

    ylab: y-axis label.

mean.labels: either a logical value indicating whether the circles
          representing the group means should be replaced with text
          giving the actual mean values or a vector containing labels
          to use instead. Defaults to FALSE.

ci.label: a logical value indicating whether text giving the actual
          interval end values should be placed at the end of each
          confidence interval bar. Defaults to FALSE.

 n.label: a logical value indicating whether text giving the number of
          observations in each group should should be added to the
          plot. 

  digits: number of significant digits to use when displaying mean or
          confidince limit values.

     col: color of cicles marking group means.  Default is "black".

barwidth: linewidth of interval bars and end marks. Default is 1.

  barcol: color of interval bars and end marks.  Default is "blue".

 connect: either a logical value indicating whether the means of each
          group should be connected by a line, or a list of vectors
          giving the index of bars that should be connected by a line.
          Defaults to TRUE.

    ccol: color of lines used to connect means. Defaults to the same
          color as "col".

 legends: vector containing strings used to label groups along the x
          axis. Defaults to group names.

     ...: optional plotting parameters. 

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

     Gregory R. Warnes Gregory_R_Warnes@groton.pfizer.com

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

     `plotCI', `boxplot'

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

       # show comparison with boxplot
       data(state)
       plotmeans(state.area ~ state.region)   

       # show some color and mean labels
       plotmeans(state.area ~ state.region,
                  mean.labels=T, digits=-3,
                  col="red", connect=F)

       # show how to specify which means should be connected
       plotmeans(state.area ~ state.region, connect=list(1:2, 3:4),
                 ccol="red", pch=7 )

