plotTempsByYear: Creates a 'ggplot2' object of daily mean air temps by year

View source: R/plotTempsByYear.R

plotTempsByYearR Documentation

Creates a ggplot2 object of daily mean air temps by year

Description

Aggregates air temeratures to mean daily values and creates a ggplot2 faceted by year. Note that this function would work for any other non-cumulative variable, if the Y-axis label is changed.

Usage

plotTempsByYear(obs = "", obsNames = "", tempCols = 1, commonYears = 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.

tempCols

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

commonYears

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

Value

If successful, returns a faceted ggplot2 object of mean daily air temperatures vs time. If unsuccessful, returns FALSE.

Author(s)

Kevin Shook.

See Also

plotPrecipsByYear

Examples

## Not run:  l <- list(meas, WRF)
names <- c("Measured", "WRF")
p <- plotTempsByYear(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.