| Title: | Quantile-Based Boxplot | 
| Version: | 0.2 | 
| Date: | 2017-11-12 | 
| Author: | Tom Pike | 
| Maintainer: | Tom Pike <tpike@lincoln.ac.uk> | 
| Description: | Produce quantile-based box-and-whisker plot(s). | 
| Depends: | stats | 
| Imports: | methods | 
| License: | GPL-2 | 
| NeedsCompilation: | no | 
| Packaged: | 2017-11-12 21:09:44 UTC; Tom Pike | 
| Repository: | CRAN | 
| Date/Publication: | 2017-11-12 21:41:23 UTC | 
Quantile-Based Boxplots
Description
Produce quantile-based box-and-whisker plot(s) of the given (grouped) values.
Usage
qboxplot(x, range=1.5, probs=c(0.25,0.5,0.75), qtype=7, data=parent.frame(),
         width=NULL, varwidth=FALSE, outline=TRUE, names=NULL, plot=TRUE,
         border=par("fg"), col=NULL, log="", pars=list(boxwex=0.8,
         staplewex=0.5, outwex=0.5), horizontal=FALSE, add=FALSE, at=NULL,
         ...)
Arguments
| x |  a formula, such as  | 
| range |  this determines how far the plot whiskers extend out from the box. If  | 
| probs | numeric vector of values in [0,1] specifying the percentiles of the upper hinge, the midpoint (usually the median) and the lower hinge. | 
| qtype |  an integer between 1 and 9 indicating which one of the nine quantile algorithms to use (see  | 
| data |  a data.frame (or list) from which the variables in  | 
| width | a vector giving the relative widths of the boxes making up the plot. | 
| varwidth |  if  | 
| outline |  if  | 
| names | group labels which will be printed under each boxplot. | 
| plot |  if  | 
| border |  an optional vector of colours for the outlines of the boxplots. The values in  | 
| col |  if  | 
| log | character indicating if x or y or both coordinates should be plotted in log scale. | 
| pars | a list of (potentially many) more graphical parameters. | 
| horizontal |  logical indicating if the boxplots should be horizontal; default  | 
| add |  logical, if  | 
| at |  numeric vector giving the locations where the boxplots should be drawn; defaults to  | 
| ... |  other arguments (see  | 
Value
List with the following components:
| stats | a matrix, each column contains the extreme of the lower whisker, the lower hinge, the midpoint, the upper hinge and the extreme of the upper whisker for one group/plot. | 
| n | a vector with the number of observations in each group. | 
| out | the values of any data points which lie beyond the extremes of the whiskers. | 
| group |  a vector of the same length as  | 
| names | a vector of names for the groups. | 
Examples
#Example 1
data = data.frame(a=runif(10), b=runif(10), c=runif(10))
qboxplot(data, range=1.3, probs=c(0.2,0.5,0.7), qtype=6)
#Example 2
qboxplot(count~spray, data=InsectSprays, col="lightgray")
#Example 3
rb = qboxplot(decrease~treatment, data=OrchardSprays, log="y", col="bisque")
title("")
rb
#Example 4
mat = cbind(Uni05=(1:100)/21, Norm=rnorm(100), "5T"=rt(100,df=5),
            Gam2=rgamma(100,shape=2))
qboxplot(as.data.frame(mat))
#Example 5
data = c(102,133,136,139,142,144,146,151,160,174)
qboxplot(data.frame(data), range=1.5, probs=c(0.25,0.5,0.75), qtype=1,
         ylim=c(100,220), horizontal=TRUE)
Helper Function For qboxplot
Description
Produce quantile-based box-and-whisker plot(s) of the given (grouped) values.
Usage
qboxplot.stats(x, probs, qtype, range, output="all")
Arguments
| x | a numeric vector of data values from which to calculate the requested statistics. | 
| probs | numeric vector of values in [0,1] specifying the percentiles of the upper hinge, the midpoint (usually the median) and the lower hinge. | 
| qtype |  an integer between 1 and 9 indicating which one of the nine quantile algorithms to use (see  | 
| output |  limit the output to  | 
| range |  this determines how far the plot whiskers extend out from the box. If  | 
Value
List with the following components:
| quantiles | a matrix, each column contains the extreme of the lower whisker, the lower hinge, the median, the upper hinge and the extreme of the upper whisker for one group/plot. | 
| outliers | a vector with the number of observations in each group. | 
| n | the values of any data points which lie beyond the extremes of the whiskers. | 
Examples
x = runif(100)
stats = qboxplot.stats(x, probs=c(0.4,0.5,0.6), qtype=7, range=1.5)
stats