bp

An R package for analyzing blood pressure data

https://github.com/johnschwenck/bp

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 12 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    3 of 5 committers (60.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.6%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

An R package for analyzing blood pressure data

Basic Info
  • Host: GitHub
  • Owner: johnschwenck
  • Language: R
  • Default Branch: master
  • Homepage:
  • Size: 3.22 MB
Statistics
  • Stars: 26
  • Watchers: 4
  • Forks: 5
  • Open Issues: 2
  • Releases: 0
Created over 5 years ago · Last pushed almost 4 years ago
Metadata Files
Readme

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# bp


[![Travis build status](https://www.travis-ci.org/johnschwenck/bp.svg?branch=master)](https://www.travis-ci.org/johnschwenck/bp)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/johnschwenck/bp?branch=master&svg=true)](https://ci.appveyor.com/project/johnschwenck/bp)

[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/bp)](https://cran.r-project.org/package=bp)
[![](https://cranlogs.r-pkg.org/badges/bp)](https://CRAN.R-project.org/package=bp)



## bp: Blood Pressure Analysis for R
Cardiovascular disease (CVD) is the leading cause of death worldwide with Hypertension, specifically, affecting over 1.1 billion people annually. The goal of the \code{bp} package is to provide a comprehensive toolbox for analyzing blood pressure (BP) data using a variety of statistical metrics and visualizations to bring more clarity to CVD.

### Installation

You can install the released version of bp from [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("bp")
```

You can install the development version from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("johnschwenck/bp")
```

For installation with vignettes:
```r
devtools::install_github("johnschwenck/bp", build_vignettes = TRUE)
```

### Sample Data
The \code{bp} package includes six sample data sets:

- `bp_hypnos`: The data set contains ABPM measurements from n= 5subjects with type 2diabetes and obstructive sleep apnea. The recordings are taken every hour during the 24-hour period for each of the two visits that are 3 months apart. Additional information includes sleep/wake indicator for each recording inferred from a wrist-worn actigraphy device. The aim of original study (Rooney et al.2021) is to determine the effect of positive airway pressure treatment of sleep apnea on glycemic control and blood pressure of patients with type 2diabetes. The included data is a subset of the full data described in [Rooneyet al.(2021)](https://clinicaltrials.gov/ct2/show/NCT02454153)
- `bp_jhs`: The data set consists of HBPM measurements from a [2019 single-subject pilot study](https://dataverse.harvard.edu/dataverse/r4r) during an endured aerobic (endurance) exercise: cycling 5,775 miles from New York City, New York to Seward, Alaska over the course of 95 days. Data was collected using an Omron Evolv wireless blood pressure monitor twice per day (in the morning upon waking up and in the evening before bed). The aim of original study (Schwenck 2019) is to assess blood pressure variability across different environments through time.
- `bp_ghana`: The data set contains HBPM measurements on n= 757subjects across 32 community health centers from cluster-randomized trial in Ghana: 389 subjects are in the health insurance coverage (HIC) group and 368 subjects are in another group consisting of a combination of HIC with a nurse-led task-shifting strategy for hypertension control (TASSH)(this group is denoted TASSH + HIC). Baseline blood pressure measurements were collected, with 85% of subjects having available 12 month follow-up measurements. The aim of original study (Ogedegbe et al.2018) is to assess the comparative effectiveness of HIC alone versus the combination of TASSH + HIC on reducing systolic blood pressure among patients with uncontrolled hypertension in Ghana.
- `bp_preg`: The data set contains HBPM measurements from n= 209women, each of whom were recorded every 30 minutes during the Pregnancy Day Assessment Clinic (PDAC) observation window for up to a maximum of 240 minutes (i.e. a maximum of 8 total readings per subject per observation window) in addition to an initial "booking" reading before the PDAC assessment. The aim of the original study (McCarthy et al.2015) is to investigate the pregnancy-induced hypertension and pre-eclampsia prediction to determine whether the blood pressure assessment of the first observation window of 1 hour (60 minutes) is sufficiently accurate relative to the standard 4 hour (240 minute) window.
- `bp_children`: The data set contains HBPM measurements on n= 1,283 children from Bristol, UK. Three blood pressure readings per visit were collected over the course of two observation periods (at ages 9 and 11). Additionally, information on their physical activity has been collected. The aim of original study (Solomon-Moore et al.2020) is to examine how sedentary behavior affect children progressing through primary school, and to understand the relationship between elevated blood pressure in children and its impact on the development of cardiovascular disease into adulthood.
- `bp_rats`: The data set contains AP measurements sampled at 100 Hz of the SS (n1= 9) and SS.13 (n2= 6) genetic strains of Dahl rats. Each mouse was administered either a low sodium or a high sodium diet. The aim of original study (Bugenhagen et al.2010) is to investigate the connection between the dysfunction of the baroreflex control system in Dahl rats and salt-sensitive Hypertension


### Intended Functionality
The `bp` package is designed to allow the user to initialize a processed dataframe through the `process_data` function by specifying any combination of the following variables present in the user-supplied data set (with the minimum requirement that `SBP` and `DBP` are included). The package will then utilize the processed dataframe to calculate various metrics from medical and statistical literature and provide visualizations. Perhaps the most useful user-friendly feature of the package is the ability to generate a visualization report to discern relationships and assess blood pressure stage progression among subjects. 

The package has the ability to make use of the following physiological variables (expressed as integers):

* Systolic Blood Pressure (`SBP`) measured in mmHg
* Diastolic Blood Pressure (`DBP`) measured in mmHg
* Arterial Pressure (`AP`) (if applicable)
* Heart Rate (`HR`) measured in bpm
* Pulse Pressure (`PP`) measured in mmHg which is calculated as SBP - DBP
* Mean Arterial Pressure (`MAP`) measured in mmHg
* Rate Pressure Product (`RPP`) which is calculated as SBP multiplied by resting HR

There are also processing functionality for arterial pressure (AP) data which include the following inputs:
* A column corresponding to the AP data (`AP`)
* Time elapsed (`time_elap`)

Furthermore, there are a suite of processing capabilities within the `process_data` function such as:

* `DATE_TIME`: A column coreresponding to a date/time object (typically `as.POSIXct` format) such as `12/1/2020 13:42:07`
* `ID`: Identification of individuals
* `VISIT`: The visit of each individual, if more than one (integer)
* `WAKE`: A binary indicator where 1 denotes awake and 0 denotes asleep (binary 1 or 0)
* `GROUP`: An arbitrary column that can be used to group data according to this category (such as gender or age)
* `EOD`: Denotes the end-of-day which can be adjusted for situations where individuals may take readings after midnight
* `DATA_SCREEN`: A screening proceedure to remove outliers based on upper and lower limits of BP readings
* `AGG`: An aggregation option to average consecutive readings taken within quick succession
* `CHRON_ORDER`: Adjust the chronology of the readings (chronological vs reverse-chronological)
* `TZ`: Time zone adjustment

After all available variables are identified and processed, the resulting processed dataframe is used for all other functions. 

Unique to the `bp` package is the ability to create additional columns that might not originally be present in the supplied data set. At current, the following additional columns will be created:

* `TIME_OF_DAY` - Corresponds to the Time of Day (Morning, Afternoon, Evening, or Night) based on `DATE_TIME` column
* `DAY_OF_WEEK` - Corresponds to the Day of the week: a useful column for table visuals. Based on `DATE_TIME` column
* `SBP_CATEGORY` - Systolic Blood Pressure Stages (Low, Normal, Elevated, Stage 1, Stage 2, Crisis) as defined by the American Heart Association (AHA)
* `DBP_CATEGORY` - Diastolic Blood Pressure Stages (Low, Normal, Elevated, Stage 1, Stage 2, Crisis) as defined by the American Heart Association (AHA)
* `BP_CLASS` - A two-to-one mapping of SBP and DBP readings that expands on the original AHA categories using a more recent adaptation by (Lee et al 2018)

See examples below for further details.

### Available Metrics
The package will then utilize the above variables to calculate various metrics from medical and statistical literature in order to quantify and classify the variability of the readings into their respective categories of hypertension (normal, elevated, or hypertensive).

The following metrics are currently offered through the `bp` package:

Function            | Metric Name                                 | Source
------------------- | ------------------------------------------- | ----------
`bp_arv`              | Average Real Variability                    | [Mena et al (2005)](https://doi.org/10.1097/01.hjh.0000160205.81652.5a)
`bp_center`           | Mean and Median                             | [Amaro Lijarcio et al (2006)](https://doi.org/10.1016/j.ejim.2006.07.023)
`bp_cv`               | Coefficient of Variation                    | [Munter et al (2011)](https://doi.org/10.1097/HJH.0b013e32834cf213 )
`bp_mag`              | Blood Pressure Magnitude (peak and trough)  | [Munter et al (2011)](https://doi.org/10.1097/HJH.0b013e32834cf213 )
`bp_range`            | Blood Pressure Range                        | [Levitan et al (2013)](https://doi.org/10.1038/jhh.2013.19)
`bp_sv`               | Successive Variation                        | [Munter et al (2011)](https://doi.org/10.1097/HJH.0b013e32834cf213 )
`bp_sleep_metrics`    | Blood Pressure Sleep Metrics                | (Multiple - see documentation)
`bp_stages`           | Blood Pressure Stages Classification        | American Heart Association
`bp_stats`            | Aggregation of statistical summaries        | N/A
`dip_calc`            | Nocturnal Dipping \% and Classification     | [Okhubo et al (1997)](https://academic.oup.com/ajh/article/10/11/1201/148906)

The following visualization functions are currently offered through the `bp` package:

Function            | Visualization Type
------------------- | -------------------------------------------
`bp_scatter`          | Scatter plot of BP stages
`bp_ts_plots`         | Time series plots
`bp_hist`             | Histograms of BP stages
`dip_class_plot`      | Dipping % category plot
`bp_report`           | Exportable report of BP summary


## Example - HYPNOS data

There are two main steps involved with the `bp` package: The data processing step and the functionality / analysis step.

1. Load and process data into a new usable dataframe for all further analysis using the `process_data` function 

```{r}
#devtools::install_github("johnschwenck/bp")
library(bp)

## Load bp_hypnos
data(bp_hypnos)

## Process bp_hypnos
hypnos_proc <- process_data(bp_hypnos, 
                     sbp = 'syst', 
                     dbp = 'diast', 
                     date_time = 'date.time', 
                     hr = 'hr', 
                     pp = 'PP', 
                     map = 'MaP', 
                     rpp = 'Rpp', 
                     id = 'id', 
                     visit = 'Visit', 
                     wake = 'wake')

```
**NOTE:** the `process_data` function is insensitive to capitalization of the supplied data column names. For this example, even though the original column name "SYST" exists in the `bp_hypnos`, "syst" is still an acceptable name to be given to the function as shown. For emphasis, all of the above column names were intentionally entered using the wrong capitalization.

`SBP` and `DBP` must be specified for any other functions to work properly.


2. Using the newly processed `hypnos_proc`, we can now calculate various metrics. Now that the included raw `bp_hypnos` dataset has been processed into `hypnos_proc`, we can now instead rely on this new dataframe to calculate various metrics and visualizations. The calculation of the nocturnal dipping classification is shown below, using a subset of only two of the subjects for comparison (subjects 70417 and 70435):
```{r}
dip_calc(hypnos_proc, subj = c(70417, 70435))
```

In terms of statistical metrics, the `bp_stats` function aggregates many of the variability and center metrics into one table which makes comparing the different measures to one another very convenient. Let's suppose for this example that we wanted to further analyze these two subjects by their `BP_CLASS`: we would include `add_groups = "BP_CLASS"` as an additional argument (note that capitalization does not matter). 
```{r}
bp_stats(hypnos_proc, subj = c(70417, 70435), add_groups = "bp_class", bp_type = 1)
```


Here is an example of the `bp_scatter` function for subject 70417:
```{r}
bp_scatter(hypnos_proc, subj = 70417)
```

Owner

  • Name: John Schwenck
  • Login: johnschwenck
  • Kind: user
  • Location: College Station, TX
  • Company: Texas A&M University

GitHub Events

Total
  • Watch event: 2
  • Issue comment event: 1
Last Year
  • Watch event: 2
  • Issue comment event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 304
  • Total Committers: 5
  • Avg Commits per committer: 60.8
  • Development Distribution Score (DDS): 0.224
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
John Schwenck j****k@s****u 236
Irina Gaynanova i****g@s****u 47
John Schwenck j****2@g****m 15
John Schwenck 6****k 5
LChun l****1@t****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 9
  • Total pull requests: 4
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 1 day
  • Total issue authors: 8
  • Total pull request authors: 2
  • Average comments per issue: 3.56
  • Average comments per pull request: 0.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • dmaywald (2)
  • bryanhanson (1)
  • chasbecker (1)
  • mahmutoezmen (1)
  • chrisb2 (1)
  • tsievert (1)
  • ataraxs (1)
  • silasalvescosta (1)
Pull Request Authors
  • johnschwenck (3)
  • LylChun (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 376 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 1
cran.r-project.org: bp

Blood Pressure Analysis in R

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 376 Last month
Rankings
Forks count: 11.3%
Stargazers count: 12.9%
Average: 25.2%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Downloads: 36.7%
Maintainers (1)
Last synced: 12 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • cowplot * imports
  • dplyr * imports
  • ggplot2 * imports
  • gridExtra * imports
  • gtable * imports
  • lubridate * imports
  • magrittr * imports
  • tibble * imports
  • tidyr * imports
  • tidyselect * imports
  • knitr * suggests
  • png * suggests
  • rmarkdown * suggests