Description Usage Arguments Details Value See Also Examples

View source: R/swmpr_analyze.R

Plot graphical summaries of SWMP data for individual parameters, including seasonal/annual trends and anomalies

1 2 3 4 5 | ```
plot_summary(swmpr_in, ...)
## S3 method for class 'swmpr'
plot_summary(swmpr_in, param, years = NULL, plt_sep = FALSE,
sum_out = FALSE, ...)
``` |

`swmpr_in` |
input swmpr object |

`...` |
additional arguments passed to other methods, currently not used |

`param` |
chr string of variable to plot |

`years` |
numeric vector of starting and ending years to plot, default all |

`plt_sep` |
logical if a list is returned with separate plot elements |

`sum_out` |
logical if summary data for the plots is returned |

This function creates several graphics showing seasonal and annual trends for a given swmp parameter. Plots include monthly distributions, monthly anomalies, and annual anomalies in multiple formats. Anomalies are defined as the difference between the monthly or annual average from the grand mean. Monthly anomalies are in relation to the grand mean for the same month across all years. All data are aggregated for quicker plotting. Nutrient data are based on monthly averages, wheras weather and water quality data are based on daily averages. Cumulative precipitation data are based on the daily maximum. An interactive Shiny widget is available: https://beckmw.shinyapps.io/swmp_summary/

Individual plots can be obtained if `plt_sep = TRUE`

. Individual plots for elements one through six in the list correspond to those from top left to bottom right in the combined plot.

Summary data for the plots can be obtained if `sum_out = TRUE`

. This returns a list with three data frames with names `sum_mo`

, `sum_moyr`

, and `sum_mo`

. The data frames match the plots as follows: `sum_mo`

for the top left, bottom left, and center plots, `sum_moyr`

for the top right and middle right plots, and `sum_yr`

for the bottom right plot.

A graphics object (Grob) of multiple `ggplot`

objects, otherwise a list of individual `ggplot`

objects if `plt_sep = TRUE`

or a list with data frames of the summarized data if `sum_out = TRUE`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
## import data
data(apacpnut)
dat <- qaqc(apacpnut)
## plot
plot_summary(dat, param = 'chla_n', years = c(2007, 2013))
## get individaul plots
plots <- plot_summary(dat, param = 'chla_n', years = c(2007, 2013), plt_sep = TRUE)
plots[[1]] # top left
plots[[3]] # middle
plots[[6]] # bottom right
## get summary data
plot_summary(dat, param = 'chla_n', year = c(2007, 2013), sum_out = TRUE)
``` |

SWMPr documentation built on Feb. 9, 2018, 6:08 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.