This function provides a simple interface to create a ggplot2::ggplot()
box plot, organising different boxplots by levels of a factor is desired,
and showing row numbers of outliers.
Usage
ggBoxplot(
dat,
y = NULL,
x = NULL,
labelOutliers = TRUE,
outlierColor = "red",
theme = ggplot2::theme_bw(),
...
)
Either a vector of values (to display in the box plot) or a
dataframe containing variables to display in the box plot.
y
If dat is a dataframe, this is the name of the variable to
make the box plot of.
x
If dat is a dataframe, this is the name of the variable
(normally a factor) to place on the X axis. Separate box plots will be
generate for each level of this variable.
### A box plot for miles per gallon in the mtcars dataset:ggBoxplot(mtcars$mpg);
### And separate for each level of 'cyl' (number of cylinder):ggBoxplot(mtcars, y='mpg', x='cyl');