sortBoxplot {plotfunctions}R Documentation

Produce box-and-whisker plot(s) ordered by function such as mean or median.

Description

Produce box-and-whisker plot(s) ordered by function such as mean or median. Wrapper around boxplot.

Usage

sortBoxplot(
  formula,
  data = NULL,
  decreasing = TRUE,
  FUN = "median",
  idx = NULL,
  col = "gray",
  ...
)

Arguments

formula

a formula, such as 'y ~ Condition', where 'y' is a numeric vector of data values to be split into groups according to the grouping variable 'Condition' (usually a factor).

data

a data.frame from which the variables in 'formula' should be taken.

decreasing

Logical: Indicating whether the sort should be increasing or decreasing.

FUN

a function to compute the summary statistics which can be applied to all data subsets.

idx

Numeric vector providing the ordering of groups instead of specifying a function in FUN. Only is used when FUN is set to NULL.

col

Fill color of the boxplots. Alias for boxfill.

...

Other parameters to adjust the layout of the boxplots. See bxp.

Value

The ordered stats.

Author(s)

Jacolien van Rij

See Also

Other Functions for plotting: addInterval(), add_bars(), add_n_points(), alphaPalette(), alpha(), check_normaldist(), color_contour(), dotplot_error(), drawDevArrows(), emptyPlot(), errorBars(), fill_area(), getCoords(), getFigCoords(), getProps(), gradientLegend(), legend_margin(), marginDensityPlot(), plot_error(), plot_image(), plotsurface()

Examples

head(ToothGrowth)
# sort on basis of mean length:
sortBoxplot(len ~ dose:supp, data = ToothGrowth)
# sort on basis of median length:
sortBoxplot(len ~ dose:supp, data = ToothGrowth, decreasing=FALSE)
# on the basis of variation (sd):
sortBoxplot(len ~ dose:supp, data = ToothGrowth, FUN='sd', col=alpha(2))

[Package plotfunctions version 1.4 Index]