Learn R Programming

SWMPr (version 2.5.0)

rem_reps: 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 swmpr rem_reps(swmpr_in, FUN = function(x) mean(x, na.rm = TRUE), ...)

Value

Returns a swmpr object for nutrient data with no replicates.

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.

See Also

qaqc

Examples

Run this code
## 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)

Run the code above in your browser using DataLab