waterbox: waterbox

waterboxR Documentation

waterbox

Description

Produces box plots from water data.

Usage

waterbox(
  object,
  parkcode = NA,
  sitecode = NA,
  charname = NA,
  category = NA,
  by = "year",
  assessment = TRUE,
  yname = NA,
  xname = NA,
  labels = NA,
  title = NULL,
  assesscolor = "red",
  outliercolor = "blue",
  sizes = c(2, 0.5, 1),
  webplot = FALSE,
  ...
)

Arguments

object

Either a data.frame that is the output of getWData, a Characteristic object a Site object, a Park object or a list of such objects.

parkcode

One or more parkcodes, in quotes. If object is a Park object or a list of Park objects, then the parkcode argument can be used to select which sites should be used.

sitecode

One or more sitecodes, in quotes. If object is a Park object or a list of Park or Site objects, then the sitcode argument can be used to select which sites should be used.

charname

Name, in quotes, #' of a single Characteristic whose data should be graphed. This is required unless category is specified or object is a data.frame.

category

Name, in quotes, #' of a single category of characteristics whose data should be graphed. This is required unless charname is specified or object is a data.frame.

by

Indicates how the data for the boxplot should be grouped. A character variable in quotes. Choices are:

"year"

The default. Will produce a boxplot for each year in the data

"month"

Will produce a boxplot for each month, combining data across years. That is all January data will be in one box, all February data in another, etc.

"site

If more than one site is included in the input object, this will produce a different box for each site.

"park"

If more than one park is included int he input object, this will produce a different box for each park.

"char"

If a single category of characteristics is chosen, this will produce a different box for each of the component characteristics.

assessment

Vector indicating if assessment points will be drawn on the graph. See details below.

yname

Text, defaults to NA. A label for the y-axis. If an Characteristic, Site, or Park object is passed to object, then the y-label will default to the Display Name and Units for the Characteristic, unless overwritten by the yname argument. If a data.frame is passed then the y-label will either be the text from yname or blank if yname is left as NA.

xname

Text, defaults to NA. A label for the x-axis. If a Characteristic, Site, or Park object is passed to object, then the x-label will default to whatever is indicated in by.unless overwritten by the xname argument. If a data.frame is passed then the x-label will either be the text from xname or blank if xname is left as NA.

labels

A character vector indicating the labels for the bars, defaults to NA. If labels are provided (one for each bar) they will be printed. If object is a data.frame and labels is NA then no labels will be printed. If object is a Characteristic, Site, or Park object, and labels is NA then the default will depend on the gropby argument. "year" will be labeled with 4 digit years, "month" with 3 letter months (Jan,Feb, etc), "site" with the site name from the Site's Display Name slot "park" with the Park's short name from the ShortName slot and "char" will use the names of the characteristics.

title

A title for the graph in quotes. Defaults to NULL, which indicates no title should be used.

assesscolor

a length one character vector with the color for the assessment lines.

outliercolor

a length one character vector with the color for the outlier points.

sizes

a length 3 numeric vector with the sizes for the outlier points, lines of the boxplot and assessment lines.

webplot

If TRUE, the plot is produced using ggploty from the ploty package. Will produce a html plot with interactive features.

...

Additional arguments used to select and filter data passed to getWData

Details

The assessment argument determines if lines representing the assessment points should be drawn on the graph. If FALSE then no lines will be drawn. If TRUE, the default, then the upper and lower assessment points indicated in object's Character objects will be used to draw the lines. Note that if there are multiple assessment points, for example if different sites have different points, or if there is both an upper and lower point, they will all be drawn. If a vector of numbers is passed to assessment instead then those will serve as the assessment points and lines will be drawn accordingly. Note that if obejct is a data.frame then the only way to draw assessment points is by passing a numeric vector to assessment.

Value

Creates a boxplot


NCRN/NCRNWater documentation built on May 15, 2023, 9:50 p.m.