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,
inc_wake = TRUE
)


### 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") inc_wake Optional argument corresponding to whether or not to include WAKE in the grouping of the final output (if WAKE column is available). By default, inc_wake = TRUE which will include the WAKE column in the groups by which to calculate the respective metrics.

### 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:

• ID: The unique identifier of the subject. For single-subject datasets, ID = 1

• VISIT: (If applicable) Corresponds to the visit # of the subject, if more than 1

• WAKE: (If applicable) Corresponds to the awake status of the subject (0 = asleep | 1 = awake)

• SBP_max / DBP_max: Finds the maximum value for the given grouping granularity

• SBP_min / DBP_min: Finds the minimum value for the given grouping granularity

• SBP_range / DBP_range: Calculates the range between the max and min values

• N: The number of observations for that particular grouping. If inc_date = TRUE, N corresponds to the number of observations for that date. If inc_date = FALSE, N corresponds to the number of observations for the most granular grouping available (i.e. a combination of ID, VISIT, and WAKE)

• Any add_groups variables supplied to function argument will be present as a column in the resulting tibble.

### Examples

# Load bp_hypnos
data(bp_hypnos)
data(bp_jhs)

# Process bp_hypnos
hypnos_proc <- process_data(bp_hypnos, sbp = "SYST", dbp = "DIAST", date_time = "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.", date_time = "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 2.1.0 Index]