The function plots the means of several numerical variables by the levels of one categorical variable.
plotMeans(
x,
by,
plotCI = TRUE,
alpha = 0.05,
ylab = "averages",
xlab = "",
plotLegend = TRUE,
inset = 0.01,
xleg = "topleft",
legPar = list(),
gap = 0,
labels = NULL,
...
)A list with the following elements:
means - mean values by groups.
CI - widths of confidence intervals by groups.
Data frame with values of numeric variables.
Categorical variable that defines groups.
Whether to plot confidence intervals or not, default is TRUE.
A confidence level for calculating confidence intervals (default is 0.05).
The title of \(y\)-axis.
The title of \(x\)-axis.
Whether to plot a legend or not, default is TRUE.
Inset distance(s) from the margins as a fraction of the plot region when legend is placed by keyword.
Position of a legend, default is topleft.
Additional parameters for a legend. They have to be provided in a list format.
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 of x-axis.
Arguments passed to functions matplot and axis.
Aleš Žiberna
plotMeans(x = mtcars[, c(1, 3, 5)], by = mtcars[,8])
Run the code above in your browser using DataLab