means_graph: Graph Means Across a Grouping Variable

Description Usage Arguments Value

View source: R/means_graph.R

Description

Creates plot showing mean of Y variable across levels of a grouping variable, with customizable error bars. Observations with missing values for y and/or group are dropped.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
means_graph(
  y,
  group,
  error.bars = "t.ci",
  alpha = 0.05,
  p.legend = TRUE,
  plot.list = NULL,
  lines.list = NULL,
  axis.list = NULL,
  legend.list = NULL,
  ...
)

Arguments

y

Numeric vector of values for the continuous variable.

group

Vector of values indicating what group each y observation belongs to. Function plots group levels across x-axis in same order as table(group).

error.bars

Character string indicating what the error bars should represent. Possible values are "sd" for +/- one standard deviation, "se" for +/- one standard error, "t.ci" for 95% confidence interval based on t distribution, "z.ci" for 95% confidence interval based on Z distribution, and "none" for no error bars.

alpha

Numeric value indicating what alpha should be set to for confidence intervals. Only used if error.bars is "t.ci" or "z.ci".

p.legend

If TRUE, p-value (from t.test function if group has 2 levels, otherwise aov function) is printed in a legend.

plot.list

Optional list of inputs to pass to plot function.

lines.list

Optional list of inputs to pass to lines function.

axis.list

Optional list of inputs to pass to axis function.

legend.list

Optional list of inputs to pass to legend function.

...

Additional arguments to pass to t.test or aov.

Value

Plot showing mean of y across levels of group.


vandomed/dvmisc documentation built on Oct. 2, 2020, 9:50 p.m.