plotMeans {multiUS} | R Documentation |
Plot the means
Description
The function plots the means of several numerical variables by the levels of one categorical variable.
Usage
plotMeans(
x,
by,
plotCI = TRUE,
alpha = 0.05,
ylab = "averages",
xlab = "",
plotLegend = TRUE,
inset = 0.01,
xleg = "topleft",
legPar = list(),
gap = 0,
labels = NULL,
...
)
Arguments
x |
Data frame with values of numeric variables. |
by |
Categorical variable that defines groups. |
plotCI |
Whether to plot confidence intervals or not, default is |
alpha |
A confidence level for calculating confidence intervals (default is |
ylab |
The title of |
xlab |
The title of |
plotLegend |
Whether to plot a legend or not, default is |
inset |
Inset distance(s) from the margins as a fraction of the plot region when legend is placed by keyword. |
xleg |
Position of a legend, default is |
legPar |
Additional parameters for a legend. They have to be provided in a list format. |
gap |
Space left between the center of the error bar and the lines marking the error bar in units of the height (width). Defaults to 1.0 |
labels |
Labels of x-axis. |
... |
Arguments passed to functions |
Value
A list with the following elements:
-
means
- mean values by groups. -
CI
- widths of confidence intervals by groups.
Author(s)
Aleš Žiberna
Examples
plotMeans(x = mtcars[, c(1, 3, 5)], by = mtcars[,8])