removeSpikes: removeSpikes

removeSpikesR Documentation

removeSpikes

Description

Identifies spikes and replaces them via interpolation

Usage

removeSpikes(v, sdLimit = 4, runLength = 99, loops = 4)

Arguments

v

The variable from which to remove spikes.

sdLimit

The multiple of the running standard deviation at which to remove spikes. Default is 4.

runLength

The number of measurements over which to calculate the running mean and standard deviation. The default is 99.

loops

The number of times to iterate the calculation.

Details

The function calculates a running mean and standard deviation, then flags points for which the deviation from the mean exceeds a specified multiplier times the running standard deviation. It then replaces those points by interpolation. It repeats this up to a specified number of times, in case the running values are changed by the removal-and-interpolation process.

Value

The input vector with identified spikes removed and replaced by interpolation.

Author(s)

William Cooper

Examples

RAFdata$DSPIKED <- removeSpikes(RAFdata$ATTACK)
RAFdata$DSPIKED <- removeSpikes(RAFdata$ATTACK, sdLimit=2, runLength=49, loops=10)

NCAR/Ranadu documentation built on Jan. 27, 2023, 1:09 a.m.