aggremetab: Aggregate metabolism data

Description Usage Arguments Details Value See Also Examples

View source: R/swmpr_analyze.R

Description

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

Usage

1
2
3
4
5
aggremetab(swmpr_in, ...)

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

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.

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.

See Also

aggregate, aggreswmp, ecometab, plot_metab

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
## 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)

## End(Not run)

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