plotPrecipsByYear: Creates a 'ggplot2' object of cumulative precips by year

View source: R/plotPrecipsByYear.R

plotPrecipsByYearR Documentation

Creates a ggplot2 object of cumulative precips by year

Description

Calculates cumulative precipitations and creates a ggplot2 faceted by year. Note that this function would work for any other cumulative variable, if the Y-axis label is changed.

Usage

plotPrecipsByYear(obs = "", obsNames = "", precipCols = 1, commonDates = TRUE)

Arguments

obs

Required. Either a CRHMr obs data frame or a list of data frames.

obsNames

Optional. A vector containing names for the data frames. If there are more data frames than names, the data will be named obs 1, obs 2 etc.

precipCols

Optional. Column(s) containing precipitation. Can be a single value or a vector. Values will be recycled if necessary. Default is 1.

commonDates

Optional. If TRUE (the default) then the range of dates will be restricted to the common first and last dates of the datasets.

Value

If successful, returns a faceted ggplot2 object of cumulative precipitation vs time. If unsuccessful, returns FALSE.

Author(s)

Kevin Shook.

See Also

plotTempsByYear

Examples

## Not run:  l <- list(meas, WRF)
names <- c("Measured", "WRF")
p <- plotPrecipsByYear(l, names)
library(ggplot2)
p <- p + scale_colour_manual(values=c("red", "blue")
## End(Not run)

CentreForHydrology/CRHMr documentation built on April 6, 2024, 5:27 p.m.