bp_report {bp} | R Documentation |
Blood Pressure Report
Description
The bp_report
function serves to aggregate various data visuals and metrics
pertaining to the supplied data set into a clean formatted report.
Usage
bp_report(
data,
subj = NULL,
inc_low = TRUE,
inc_crisis = TRUE,
group_var = NULL,
save_report = TRUE,
path = NULL,
filename = "bp_report",
width = 11,
height = 8.5,
filetype = "pdf",
units = "in",
scale = 1.25,
plot = TRUE,
hist_bins = 30
)
Arguments
data |
Required argument. A processed dataframe resulting from the
|
subj |
Optional argument. Allows the user to specify and subset specific subjects
from the |
inc_low |
Optional logical argument dictating whether or not to include the "Low" category for BP classification column (and the supplementary SBP/DBP Category columns). Default set to TRUE. |
inc_crisis |
Optional logical argument dictating whether or not to include the "Crisis" category for BP classification column (and the supplementary SBP/DBP Category columns). Default set to TRUE. |
group_var |
A categorical column of the input data set that the individual points are to
be grouped / separated by for a given plot. Cannot contain more than 10 levels (to avoid
overcrowding the plot). This is different from the |
save_report |
A logical value indicating whether to save the BP report output as a separate file.
The default is |
path |
Optional argument. A string corresponding to the respective file path by which the
report is to be saved. Do not include trailing slashes (i.e. ~/loc/) or the file name (i.e. ~/loc/testfile.pdf).
By default, if not |
filename |
Optional argument. A string corresponding to the name of the report. The default is
"bp_report". The string cannot begin with a number or non-alphabetical character.
|
width |
Optional argument. An numeric value corresponding to the width of the output document. The default is set to 12 inches. |
height |
Optional argument. An numeric value corresponding to the height of the output document. The default is set to 8.53 inches. |
filetype |
A string corresponding to he particular type of file that the report is to be saved as. Although PDF is the default possible options include:
|
units |
A character string corresponding to the unit of measurement that the width and height correspond to in the exported output. The default is inches ("in"), but centimeters ("cm") and millimeters ("mm") are also available. |
scale |
A multiplicative scaling factor for the report output. |
plot |
A logical value indicating whether to automatically produce the plot of bp_report, or suppress the output. The default value is TRUE. If false, the returned object is a grob that can be plotted using |
hist_bins |
An integer specifying how many bins to use for histogram plots. This is a ggplot parameter; default value set to 30 |
Value
If plot = TRUE
, the function produces a plot of BP report that contains scatterplot of BP values by stages (see bp_scatter
), histograms of BP values by stages (see bp_hist
) and frequency tables of BP values by stages and day of the week/time of the day (see dow_tod_plots
). If plot = FALSE
, the function returns the grob object that can be plotted later using grid.arrange
. If save_report = TRUE
, the report will be automatically saved at the current working directory (can be checked using getwd()
) or at specified file path.
Examples
data("bp_jhs")
data("bp_hypnos")
hyp_proc <- process_data(bp_hypnos,
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)
## Not run:
# Single-subject Report
# save_report = FALSE for illustrative purposes
# plot = TRUE will automatically generate a plot
bp_report(jhs_proc, save_report = FALSE, plot = TRUE)
# Multi-subject Report
# save_report = FALSE for illustrative purposes
# plot = FALSE will suppress the plot output and return a grob object
out = bp_report(hyp_proc, group_var = 'VISIT', save_report = FALSE, plot = FALSE)
gridExtra::grid.arrange(out)
## End(Not run)