Make boxplots

boxwork(df, x, y, xs = defcx(), ys = defy(), fill = "white",
  alpha = 1, hline = NULL, title = NULL, shown = TRUE, ...)

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)

...

not used

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.