Learn R Programming

SWMPr (version 2.5.0)

aggremetab: Aggregate metabolism data

Description

Aggregate a metabolism attribute from swmpr data by a specified time period and method

Usage

aggremetab(swmpr_in, ...)

# S3 method for swmpr aggremetab(swmpr_in, by = "weeks", na.action = na.pass, alpha = 0.05, ...)

Value

Returns an aggregated metabolism data.frame if the metabolism attribute of the swmpr object is not NULL. Upper and lower confidence limits are also provided if the aggregation period was specified as a character string.

Arguments

swmpr_in

input swmpr object

...

additional arguments passed to other methods

by

chr string or numeric value specifying aggregation period. If chr string, must be 'years', 'quarters', 'months', 'weeks', 'days', or 'hours'. A numeric value indicates the number of days for a moving window average. Additional arguments passed to smoother can be used if by is numeric.

na.action

function for treating missing data, default na.pass

alpha

numeric indicating alpha level of confidence interval for aggregated data

Details

The function summarizes metabolism data by averaging across set periods of observation. Confidence intervals are also returned based on the specified alpha level. It is used within plot_metab function to view summarized metabolism results. Data can be aggregated by 'years', 'quarters', 'months', or 'weeks' for the supplied function, which defaults to the mean. The method of treating NA values for the user-supplied function should be noted since this may greatly affect the quantity of data that are returned.

See Also

aggregate, aggreswmp, ecometab, plot_metab

Examples

Run this code
if (FALSE) {
## import water quality and weather data
data(apadbwq)
data(apaebmet)

## qaqc, combine
wq <- qaqc(apadbwq)
met <- qaqc(apaebmet)
dat <- comb(wq, met)

## estimate metabolism
res <- ecometab(dat)

## change aggregation period and alpha
aggremetab(res, by = 'months', alpha = 0.1)

## use a moving window average of 30 days
aggremetab(res, by = 30)

## use a left-centered window instead
aggremetab(res, by = 30, sides = 1)
}

Run the code above in your browser using DataLab