bp_stats {bp}R Documentation

Aggregated BP Summary Statistics


Combines the output from the following functions:


bp_stats(data, inc_date = FALSE, subj = NULL, bp_type = 0, add_groups = NULL)



Required argument. Pre-processed dataframe containing SBP and DBP with optional ID, VISIT, WAKE, and DATE columns if available. Use process_data to properly format data.


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.


Optional argument.


Optional argument. Determines whether to calculate ARV for SBP values or DBP values. Default is 0 corresponding to output for both SBP & DBP. For both SBP and DBP ARV values use bp_type = 0, for SBP-only use bp_type = 1, and for DBP-only use bp_type = 2


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")


A tibble object with a row corresponding to each subject, or alternatively a row corresponding to each date, if inc_date = TRUE. The resulting tibble consists of:


# Load data

# 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.")

# BP Stats Aggregated Table
bp_stats(hypnos_proc, subj = c(70417, 70435), add_groups = c("SBP_Category"))
bp_stats(jhs_proc, add_groups = c("SBP_Category"))

[Package bp version 1.0.1 Index]