Learn R Programming

heartbeatr (version 1.0.0)

pulse_heart: (STEP 4) Determine the heartbeat rate in all channels of a split PULSE object

Description

  • step 1 -- pulse_read()

  • step 2 -- pulse_split()

  • step 3 -- pulse_optimize()

  • -->> step 4 -- pulse_heart() <<--

  • step 5 -- pulse_doublecheck()

  • step 6 -- pulse_choose_keep()

For each combination of channel and time window, determine the heartbeat rate automatically.

pulse_heart() takes the output from a call to pulse_optimize() (or pulse_split() if optimization is skipped, but that is highly discouraged) and employs an algorithm optimized for the identification of wave peaks in noisy data to determine the heart beat frequency in all channels of the PULSE dataset.

Usage

pulse_heart(pulse_data_split, msg = TRUE, show_progress = FALSE)

Value

A tibble with nrows = (number of channels) * (number of windows in pulse_data_split) and 10 columns:

  • i, index of each time window's order

  • smoothed, whether the data has been smoothed with pulse_smooth()

  • id, PULSE channel IDs

  • time, time at the center of each time window

  • data, a list of tibbles with raw PULSE data for each combination of channel and window, with columns time, val and peak (TRUE in rows corresponding to wave peaks)

  • hz, heartbeat rate estimate (in Hz)

  • n, number of wave peaks identified

  • sd, standard deviation of the intervals between wave peaks

  • ci, confidence interval (hz ± ci)

  • keep, whether n and sd are within the target thresholds

Arguments

pulse_data_split

the output from a call to pulse_split()

msg

logical, defaults to TRUE; should non-crucial messages (but not errors) be shown (mostly for use from within the wrapper function PULSE(), where it is set to FALSE to avoid the repetition of identical messages)

show_progress

logical, defaults to FALSE. If set to TRUE, progress messages will be provided.

BPM

To convert to Beats Per Minute, simply multiply hz and ci by 60.

See Also

  • pulse_find_peaks_all_channels() runs pulse_find_peaks_one_channel() on all PULSE channels

  • pulse_read(), pulse_split(), pulse_optimize(), pulse_doublecheck() and pulse_choose_keep() are the other functions needed for the complete PULSE processing workflow

  • PULSE() is a wrapper function that executes all the steps needed to process PULSE data at once

  • pulse_summarise() can be used to reduce the number of data points returned

Examples

Run this code
## Begin prepare data ----
pulse_data_sub <- pulse_data
pulse_data_sub$data <- pulse_data_sub$data[,1:3]
pulse_data_split <- pulse_split(pulse_data_sub)
pulse_data_split <- pulse_optimize(pulse_data_split, multi = pulse_data$multi)
## End prepare data ----

# Determine heartbeat rates in all channels in all time window
pulse_heart(pulse_data_split)

Run the code above in your browser using DataLab