This function takes the output of detect_hrv_artefacts (a tibble with RR intervals and artefact classifications) and performs the actual artefact correction, including:

correct_hrv_artefacts_lipponen(data)

Arguments

data

A dplyr::tibble returned by detect_hrv_artefacts, containing 'time' and 'classification' columns.

Value

A dplyr::tibble with the following columns:

  • time: The corrected RR intervals (in milliseconds).

  • classification: The updated classification column. Intervals that were corrected by interpolation will have the classification "interpolated". Inserted "missed" beats will have the classification "missed". Removed beats will not be present.

Details

  • Interpolation: Ectopic, long, and short beats are corrected by replacing the identified intervals with values obtained via cubic spline interpolation.

  • Removal: Extra beats are removed.

  • Insertion: Rows are inserted for missed beats, with the time value set to half the duration of the long interval.