bp_hist: Blood Pressure Histograms

View source: R/bp_visuals_hist.R

bp_histR Documentation

Blood Pressure Histograms

Description

The bp_hist function serves to display the frequencies of the SBP and DBP readings. These histograms are formatted to complement the bp_scatter function.

Usage

bp_hist(data, subj = NULL, bins = 30, na.rm = TRUE)

Arguments

data

A processed dataframe resulting from the process_data function that contains the SBP, DBP, SBP_CATEGORY, and DBP_CATEGORY columns.

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.

bins

An integer specifying how many bins to use for histogram plots. This is a ggplot parameter; default value set to 30

na.rm

An logical value specifying whether or not to remove empty values from data frame. This is a ggplot parameter; default value set to TRUE.

Value

A list containing four objects: three histogram visual graphics corresponding to the SBP / DBP totals, SBP frequency, and DBP frequency, and a fourth list element corresponding to a plot legend object for use in the bp_report function

Examples

data("bp_jhs")
data("bp_hypnos")
hyp_proc <- process_data(bp_hypnos,
                         bp_type = 'abpm',
                         sbp = "syst",
                         dbp = "DIAST",
                         date_time = "date.time",
                         id = "id",
                         wake = "wake",
                         visit = "visit",
                         hr = "hr",
                         map = "map",
                         rpp = "rpp",
                         pp = "pp",
                         ToD_int = c(5, 13, 18, 23))

jhs_proc <- process_data(bp_jhs,
                         sbp = "Sys.mmHg.",
                         dbp = "Dias.mmHg.",
                         date_time = "DateTime",
                         hr = "pulse.bpm.")
rm(bp_hypnos, bp_jhs)

bp_hist(hyp_proc)
bp_hist(jhs_proc)

bp documentation built on May 10, 2022, 5:12 p.m.