find_hr: Find heart rate from ECG data

Description Usage Arguments Details Value Examples

View source: R/find_hr.R

Description

find_hr is an interactive tool for processing ECG data to get heart rate profiles. Use it to identify individual heart beats and gaps in ECG the ECG data.

Usage

1

Arguments

data

A data.frame with columns timestamp (POSIXct) and ecg (numeric)

Details

The GUI is divided into a side panel with controls and a main panel with plots. The side panel has controls for choosing the interaction mode, exporting results, and exiting. The main panel shows up to three plots for viewing and interacting with the data. As you interact with the plots, more detailed views appear.

  1. The top plot shows the entire ECG profile, including data before and after deployment. Brush (click and drag) the part of the profile with the deployment itself.

  2. The middle plot is a profile of the deployment. Brush it to zoom in to shorter periods so you can see individual heart beats.

  3. The bottom plot shows data in the most detailed view. Clicking and brushing the data will add/clear heart beats and gaps.

There are five interaction modes. In "Add heart beat" mode, clicking will add a heart beat on the nearest peak (should be the QRS complex). "Clear heart beat" will remove the nearest beat. Use "Add gap" to brush areas with unusable data, to avoid artificially low heart rates. Overlapping gaps are merged automatically. In "Clear gap" mode, click on gaps to clear them. "Set beat threshold" adds heart beats in bulk. Clicking will add a heart beat to every peak higher than the click point. This will only add beats to the part of the data visible in the detail plot.

There are two buttons at the bottom of the side panel for when you're done using the tool. "Download heart beats" exports the heart rate data to CSV and "Finish and return data.frame" quits the tool and returns the result.

Value

A data.frame with columns

Examples

1
2
3
4
5
6
7
8
9
if (interactive()) {
  # File path to sample data
  fp <- system.file("extdata", "max_ecg_190826b.ube", package = "beats")
  # Read ube file
  ecg_data <- read_ube(fp)
  # Launch GUI
  heartbeats <- find_hr(ecg_data)
  # In this heart rate profile, zoom into 12:53:20 - 12:54:25 to see actual beats
}

Example output



beats documentation built on March 26, 2020, 5:51 p.m.