Make boxplots

boxwork(
  df,
  x,
  y,
  xs = defcx(),
  ys = defy(),
  fill = opts$boxplot.fill,
  alpha = opts$boxplot.alpha,
  hline = NULL,
  title = NULL,
  shown = TRUE,
  points = NULL,
  outlier.shape = opts$boxplot.outlier.shape,
  ...
)

Arguments

df

data frame to plot

x

character name for x-axis data

y

character name for y-axis data

xs

see defcx

ys

see defy

fill

passed to geom_boxplot

alpha

passed to geom_boxplot

hline

used to draw horizontal reference line

title

passed to ggtitle

shown

if TRUE provide a numeric summary of each box (see details)

points

show points in back of transparent boxes; if TRUE, a default display of points is made on top of boxes; also may be passed as a list of arguments to pass to geom_point; see details

outlier.shape

passed to geom_boxplot

...

arguments passed to geom_boxplot

Details

Since this function creates a boxplot, the x column must be character, factor or logical and y column must be numeric.

If shown is TRUE, a numeric summary of each box is included below each box. In the summary, n is the number of non-NA observations in the y column for that box and N is the number of unique ID values for that box. An error will be generated if ID does not exist in the plotting data frame when shown is TRUE. When N is equal to n in the summary, only n is shown.

The summaries will not be correct if the plot is eventually faceted by another variable in the data set. In this case, either use shown=FALSE or create the plot with split_plot.

When the user passes the points argument, outlier.shape is automatically switched to NA so that outlier points are only plotted once. The fill argument is also set to NA, so that boxes become transparent, showing the points.

When the user sets points to TRUE, grey points are shown in back of transparent boxes and the points are jittered in the x-direction. The user can customize the display of the points by passing a list of arguments for geom_point (for example, change the color, transparency, size, jitter amount, etc).