PPG2beats: Extract beats from PPG signal

View source: R/signals_PPG.R

PPG2beatsR Documentation

Extract beats from PPG signal

Description

This functions employs a low pass filter to attenuate non-systolic peaks, then rejects peaks that are too fast compared to the median rate of a buffer. Finally it interpolates too large gaps.

Usage

PPG2beats(
  x,
  r = 0.65,
  f = 0.75,
  buffer = 8,
  FIR_args = list(type = "low", cut = 3, NAsub = 0),
  correctionRangeSeconds = 1/1.5,
  minPeakAmplitude = 0.01,
  plotName = NULL,
  ...
)

Arguments

x

a rats time-series representing the original PPG signal

r

the rejection factor, expressed as a weight of the buffer's median R-R interval

f

the fill factor, expressed as a weight of the buffer's median R-R interval

buffer

integer. the rolling buffer, expressed in number of beats

FIR_args

a named list of arguments to be passed to FIR) filtering function. 'cut' and 'type' must be present, representing . If empty, the filtering is disabled.

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

plotName

an optional filename to save a svg representation of the beats extraction

Value

a list of:

bool

a logical vector of the same length of x with TRUE value corresponding to a match

samples

the position of beats relatively to x's index

x

temporal coordinates of the beats (if x has a frequency attribute)

y

The value of x correspoding to the detected beats

type

a character vector defining for each beats if its a detected peak ('p') or an interpolated one ('p_filled')

amp

the through-to-peak amplitudes of the detected beats

index

The absolute position of the beats along the signal. The values are independent from the 'mode' argument, allowing interaction between different calls of the function.

reject_samples

the position of rejected beats relatively to x's index


kleinbub/rIP documentation built on June 11, 2025, 3:39 a.m.