desp_loop: Apply despiking to all data blocks

Description Usage Arguments Value

Description

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

Usage

1
desp_loop(sd_sub, date, n, z, c, plot = FALSE)

Arguments

sd_sub

A data frame prepared by despike with expected columns index, date, timestamp, var, spike and light This is a subset of data (x) provided to despike containing only the data of good quality.

date

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

n

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.


grahamstewart12/tidyflux documentation built on June 4, 2019, 7:44 a.m.