bp_cv | R Documentation |
Calculate the coefficient of variation at various levels of granularity based on what is supplied (ID, VISIT, WAKE, and / or DATE) for either SBP, DBP, or both. CV is a measure of dispersion
bp_cv( data, inc_date = FALSE, subj = NULL, bp_type = c("both", "sbp", "dbp"), add_groups = NULL, inc_wake = TRUE )
data |
Required argument. Pre-processed dataframe with SBP and DBP columns
with optional ID, VISIT, WAKE, and DATE columns if available.
Use |
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 |
bp_type |
Optional argument. Determines whether to calculate CV for SBP values or DBP values, or both. For both SBP and DBP ARV values use bp_type = 'both', for SBP-only use bp_type = 'sbp, and for DBP-only use bp_type = 'dbp'. If no type specified, default will be set to 'both' |
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 |
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:
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)
CV_SBP
/ CV_DBP
: Calculates the ratio of standard deviation to the mean. CV_SBP
or CV_DBP
is useful for comparing the degree of variation from one data series
to another.
SD_SBP
/ SD_DBP
: For completeness, the cv
function also includes the
standard deviation as a comparison metric to measure spread around the average.
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.
# Load data data(bp_hypnos) data(bp_jhs) # Process bp_hypnos hyp_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.") # CV Calculation bp_cv(hyp_proc, inc_date = TRUE, add_groups = "SBP_Category", bp_type = 'sbp') bp_cv(jhs_proc, add_groups = c("meal_time")) # Notice that meal_time is not a column from process_data, but it still works
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.