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,
inc_wake = TRUE
)
Arguments
data |
Required dataframe with SBP and DBP columns corresponding to
Systolic and Diastolic BP. This dataframe should come from |
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 |
subj |
Optional argument. Allows the user to specify and subset specific subjects
from the |
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 |
inc_wake |
Optional argument corresponding to whether or not to include |
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. Ifinc_date = TRUE
,N
corresponds to the number of observations for that date. Ifinc_date = FALSE
,N
corresponds to the number of observations for the most granular grouping available (i.e. a combination ofID
,VISIT
, andWAKE
) 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