bp_scatter {bp}R Documentation

Blood Pressure Stage Scatter Plot

Description

The bp_scatter function serves to display all SBP and DBP readings on a scatterplot based on which stage each recording lies, according to the levels set by the American Heart Association (AHA) (although the lower / upper limits for these stages can be adjusted in using the sbp_stages_alt and dbp_stages_alt functions). There are six total stages which are the following:

Note: Because of the visual disparity between DBP readings for Normal and Elevated (both are defined as DBP below 80), the bp_scatter plot splits the difference and lists the DBP range for Normal to be from 60 - 80, Elevated from 80 - 85, and Stage 1 from 85 - 90.

Usage

bp_scatter(data, sbp_stages_alt = NULL, dbp_stages_alt = NULL, subj = NULL)

Arguments

data

A processed dataframe resulting from the process_data function that contains the VISIT (potentially, depending whether or not that information is available), SBP, and DBP columns.

sbp_stages_alt

Optional argument that allows the user to supply their own set of systolic blood pressure (SBP) stage thresholds. This parameter must be a vector containing 7 integers that correspond to the lower and upper limits of each of the 6 stages. The limits must be adjacent to one another as to not overlap (i.e. the upper limit for one stage must be the lower limit for the next).

For example, the alternative vector: sbp_stages_alt = c(90, 110, 120, 130, 140, 160, 200) corresponds to a Low stage from 90 - 110, a Normal stage from 110 - 120, and so forth for all 6 stages.

dbp_stages_alt

Optional argument that allows the user to supply their own set of diastolic blood pressure (DBP) stage thresholds. This parameter must be a vector containing 7 integers that correspond to the lower and upper limits of each of the 6 stages. The limits must be adjacent to one another as to not overlap (i.e. the upper limit for one stage must be the lower limit for the next).

For example, the alternative vector: dbp_stages_alt = c(30, 70, 90, 100, 110, 120, 140) corresponds to a Low stage from 30 - 70, a Normal stage from 70 - 90, and so forth for all 6 stages.

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.

Value

A scatter plot graphic using the ggplot2 package overlaying each reading (represented as points) onto a background that contains each stage

Examples

data("bp_jhs")
data("hypnos_data")
hyp_proc <- process_data(hypnos_data,
                         sbp = "syst",
                         dbp = "DIAST",
                         bp_datetime = "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.",
                         bp_datetime = "DateTime",
                         hr = "pulse.bpm.")
rm(hypnos_data, bp_jhs)

# An example of a multiple-subject data set with
# all points aggregated across subjects, split by visits:

bp_scatter(hyp_proc)


# An example of a multiple-subject data set being filtered
# to one individual for one particular visit:

hyp_proc %>% dplyr::group_by(ID, VISIT) %>% dplyr::filter(ID == 70417, VISIT == 1) %>% bp_scatter()


# An example of a single-subject data set without
# any VISIT variable present in the data:

bp_scatter(jhs_proc)

[Package bp version 1.0.1 Index]