desp_loop: Apply despiking to all data blocks

View source: R/Quality_checking.R

desp_loopR Documentation

Apply despiking to all data blocks

Description

This is a low level function not intended to be used on its own. It is utilized by despikeLF that should be used instead.

Usage

desp_loop(SD_sub, date, nVals, z, c, plot = FALSE)

Arguments

SD_sub

A data frame prepared by despikeLF with expected columns Index, Date, timestamp, var, Spike and Light. This is a subset of data (x) provided to despikeLF containing only the data of good quality.

date

An unsubsetted vector of class "Date" extracted from data frame x fed to despikeLF.

nVals

A numeric value. Number of values within 13-day blocks required to obtain robust statistics.

z

A numeric value. MAD scale factor.

c

A numeric value. mad scale factor. Default is 3 * mad constant (i.e. 3 * 1.4826 = 4.4478).

plot

A logical value. If TRUE, list of ggplot objects visualizing the spikes is also produced.

Value

If plot = FALSE, an updated data frame SD_sub with identified spikes in column Spike and with three new columns var_minus, var_plus and diff. If plot = TRUE, a list with elements SD (a data frame identical to the one produced if plot = FALSE) and plots containing a list of ggplot objects.


lsigut/openeddy documentation built on Aug. 5, 2023, 12:25 a.m.