bp_range {bp}R Documentation

Blood Pressure Range

Description

Calculates the range (max - min) of both SBP and DBP values in addition to max and min values for reference with the option to specify date as an additional level of granularity

Usage

bp_range(data, inc_date = FALSE, subj = NULL, add_groups = NULL)

Arguments

data

Required dataframe with SBP and DBP columns corresponding to Systolic and Diastolic BP. This dataframe should come from data_process

inc_date

Optional argument. Default is FALSE. As ABPM data typically overlaps due to falling asleep on one date and waking up on another, the inc_date argument is typically kept as FALSE, but the function will work regardless. Setting inc_date = TRUE will include these dates as a grouping level.

subj

Optional argument. Allows the user to specify and subset specific subjects from the ID column of the supplied data set. The subj argument can be a single value or a vector of elements. The input type should be character, but the function will comply with integers so long as they are all present in the ID column of the data.

add_groups

Optional argument. Allows the user to aggregate the data by an additional "group" to further refine the output. The supplied input must be a character vector with the strings corresponding to existing column names of the processed data input supplied. Capitalization of add_groups does not matter. Ex: add_groups = c("Time_of_Day")

Value

A tibble with SBP_max, SBP_min, SBP_range, DBP_max, DBP_min, DBP_range and any additional optional columns included in data such as ID, VISIT, WAKE, and DATE. If inc_date = TRUE, each row will correspond to a date. The resulting tibble consists of:

Examples

# Load hypnos_data
data(hypnos_data)
data(bp_jhs)

# Process hypnos_data
hypnos_proc <- process_data(hypnos_data, sbp = "SYST", dbp = "DIAST", bp_datetime = "date.time",
id = "id", wake = "wake", visit = "visit", hr = "hr", pp ="pp", map = "map", rpp = "rpp")
# Process bp_jhs data
jhs_proc <- process_data(bp_jhs, sbp = "Sys.mmHg.", dbp = "Dias.mmHg.", bp_datetime = "DateTime",
hr = "Pulse.bpm.")

# Calculate BP range
bp_range(hypnos_proc)
bp_range(jhs_proc, inc_date = TRUE, add_groups = c("meal_time"))
# Notice that meal_time is not a column from process_data, but it still works

[Package bp version 1.0.1 Index]