rem_reps: Remove replicates in nutrient data

View source: R/rem_reps.R

rem_repsR Documentation

Remove replicates in nutrient data

Description

Remove replicates in SWMP nutrient data to keep approximate monthly time step

Usage

rem_reps(swmpr_in, ...)

## S3 method for class 'swmpr'
rem_reps(swmpr_in, FUN = function(x) mean(x, na.rm = TRUE), ...)

Arguments

swmpr_in

input swmpr object

...

arguments passed to other methods

FUN

function to combine values, defaults to mean

Details

Raw nutrient data obtained from the CDMO will usually include replicate samples that are taken within a few minutes of each other. This function combines nutrient data that occur on the same day. The datetimestamp column will always be averaged for replicates, but the actual observations will be combined based on the user-supplied function which defauls to the mean. Other suggested functions include the median, min, or max. The entire function call including treatment of NA values should be passed to the FUN argument (see the examples). The function is meant to be used after qaqc processing, although it works with a warning if QAQC columns are present.

Value

Returns a swmpr object for nutrient data with no replicates.

See Also

qaqc

Examples

## get nutrient data
data(apacpnut)
swmp1 <- apacpnut

# remove replicate nutrient data
rem_reps(swmp1)

# use different function to aggregate replicates
func <- function(x) max(x, na.rm = TRUE)
rem_reps(swmp1, FUN = func)

SWMPr documentation built on June 24, 2024, 5:08 p.m.