View source: R/signals_processing.R
peakFinder | R Documentation |
Finds peaks and throughs features in a time series
peakFinder(
x,
sgol_p = 2,
sgol_n = 25,
mode = c("peaks", "valleys", "both"),
correctionRangeSeconds,
minPeakAmplitude
)
x |
a rats, ts, or a numeric vector. |
sgol_p |
smoothing filter order. If NA, the filtering is disabled. |
sgol_n |
smoothing filter length (must be odd). |
mode |
should the function return only 'peaks', 'valleys', or 'both'? |
correctionRangeSeconds |
the half range in which the real maximum/minimum value should be searched, in seconds. around the derivative shift. Should be less then the periodicity of the signal. 0.5 is good for skin conductance. |
minPeakAmplitude |
the minimum delta from valley to peak for detection. Skin conductance traditionally uses 0.05uS, or 0.03uS |
The function has a relatively simple yet robust implementation: after a Sgolay smoothing, the first derivative's sign changes are detected. Then, the actual minima or maxima is looked for in a given range. NOTE: the function ensures that no consecutive throughs or peaks are returned.
a list of:
a logical vector of the same length of x with TRUE value corresponding to a match
the position of features relatively to x's index
temporal coordinates of the features (if x has a frequency attribute)
a character vector defining for each "samples" value if its a 'p' peak or a 'v' valley (trough)
The value of x correspoding to the detected features
the positive (v->p) and negative (p->v) amplitudes of the detected features
The absolute position of the features along the signal. The values are independent from the 'mode' argument, allowing interaction between different calls of the function.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.