Movatterモバイル変換


[0]ホーム

URL:


bp

CRAN_Status_Badge

R-CMD-check

bp: Blood Pressure Analysisfor R

Cardiovascular disease (CVD) is the leading cause of death worldwidewith Hypertension, specifically, affecting over 1.1 billion peopleannually. The goal of the package is to provide a comprehensive toolboxfor analyzing blood pressure (BP) data using a variety of statisticalmetrics and visualizations to bring more clarity to CVD.

Installation

You can install the released version of bp fromCRAN with:

install.packages("bp")

You can install the development version fromGitHub with:

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

For installation with vignettes:

devtools::install_github("johnschwenck/bp",build_vignettes =TRUE)

Sample Data

The package includes six sample data sets:

Intended Functionality

Thebp package is designed to allow the user toinitialize a processed dataframe through theprocess_datafunction by specifying any combination of the following variablespresent in the user-supplied data set (with the minimum requirement thatSBP andDBP are included). The package willthen utilize the processed dataframe to calculate various metrics frommedical and statistical literature and provide visualizations. Perhapsthe most useful user-friendly feature of the package is the ability togenerate a visualization report to discern relationships and assessblood pressure stage progression among subjects.

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

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

Furthermore, there are a suite of processing capabilities within theprocess_data function such as:

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

Unique to thebp package is the ability to createadditional columns that might not originally be present in the supplieddata set. At current, the following additional columns will becreated:

See examples below for further details.

Available Metrics

The package will then utilize the above variables to calculatevarious metrics from medical and statistical literature in order toquantify and classify the variability of the readings into theirrespective categories of hypertension (normal, elevated, orhypertensive).

The following metrics are currently offered through thebp package:

FunctionMetric NameSource
bp_arvAverage Real VariabilityMena etal (2005)
bp_centerMean and MedianAmaro Lijarcioet al (2006)
bp_cvCoefficient of VariationMunter et al(2011)
bp_magBlood Pressure Magnitude (peak and trough)Munter et al(2011)
bp_rangeBlood Pressure RangeLevitan et al(2013)
bp_svSuccessive VariationMunter et al(2011)
bp_sleep_metricsBlood Pressure Sleep Metrics(Multiple - see documentation)
bp_stagesBlood Pressure Stages ClassificationAmerican Heart Association
bp_statsAggregation of statistical summariesN/A
dip_calcNocturnal Dipping % and ClassificationOkhubo etal (1997)

The following visualization functions are currently offered throughthebp package:

FunctionVisualization Type
bp_scatterScatter plot of BP stages
bp_ts_plotsTime series plots
bp_histHistograms of BP stages
dip_class_plotDipping % category plot
bp_reportExportable report of BP summary

Example - HYPNOS data

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

  1. Load and process data into a new usable dataframe for all furtheranalysis using theprocess_data function
#devtools::install_github("johnschwenck/bp")library(bp)## Load bp_hypnosdata(bp_hypnos)## Process bp_hypnoshypnos_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')#> 2 values that exceeded the DUL or DLL thresholds were coerced to NA.

NOTE: theprocess_data function isinsensitive to capitalization of the supplied data column names. Forthis example, even though the original column name “SYST” exists in thebp_hypnos, “syst” is still an acceptable name to be givento the function as shown. For emphasis, all of the above column nameswere intentionally entered using the wrong capitalization.

SBP andDBP must be specified for any otherfunctions to work properly.

  1. Using the newly processedhypnos_proc, we can nowcalculate various metrics. Now that the included rawbp_hypnos dataset has been processed intohypnos_proc, we can now instead rely on this new dataframeto calculate various metrics and visualizations. The calculation of thenocturnal dipping classification is shown below, using a subset of onlytwo of the subjects for comparison (subjects 70417 and 70435):
dip_calc(hypnos_proc,subj =c(70417,70435))#> [[1]]#> # A tibble: 8 × 6#> # Groups:   ID, VISIT [4]#>   ID    VISIT WAKE  avg_SBP avg_DBP     N#>   <fct> <fct> <fct>   <dbl>   <dbl> <int>#> 1 70417 1     0        123.    60.5    10#> 2 70417 1     1        128     66.6    20#> 3 70417 2     0        136.    60.5     8#> 4 70417 2     1        136.    65.6    17#> 5 70435 1     0        106.    63       6#> 6 70435 1     1        129.    82.1    23#> 7 70435 2     0        136.    79.2     9#> 8 70435 2     1        123.    72.5    20#>#> [[2]]#> # A tibble: 4 × 6#> # Groups:   ID [2]#>   ID    VISIT  dip_sys class_sys  dip_dias class_dias#>   <fct> <fct>    <dbl> <chr>         <dbl> <chr>#> 1 70417 1      0.0359  non-dipper   0.0916 non-dipper#> 2 70417 2     -0.00450 reverse      0.0784 non-dipper#> 3 70435 1      0.179   dipper       0.233  extreme#> 4 70435 2     -0.104   reverse     -0.0927 reverse

In terms of statistical metrics, thebp_stats functionaggregates many of the variability and center metrics into one tablewhich makes comparing the different measures to one another veryconvenient. Let’s suppose for this example that we wanted to furtheranalyze these two subjects by theirBP_CLASS: we wouldincludeadd_groups = "BP_CLASS" as an additional argument(note that capitalization does not matter).

bp_stats(hypnos_proc,subj =c(70417,70435),add_groups ="bp_class",bp_type ="both")#> # A tibble: 35 × 27#> # Groups:   ID, VISIT, WAKE [8]#>    ID        N VISIT WAKE  BP_CLASS SBP_mean DBP_mean SBP_med DBP_med SD_SBP#>    <fct> <int> <fct> <fct> <ord>       <dbl>    <dbl>   <dbl>   <dbl>  <dbl>#>  1 70417     5 1     0     Normal       114.     54.6     114    56     3.51#>  2 70417     3 1     0     Elevated     125.     60.3     125    64     1.53#>  3 70417     2 1     0     ISH - S2     143      75.5     143    75.5   2.83#>  4 70417     3 1     1     Normal       116.     67       118    68     4.04#>  5 70417     9 1     1     Elevated     125.     65.2     124    66     2.54#>  6 70417     6 1     1     ISH - S1     134.     67.8     133    67.5   2.42#>  7 70417     2 1     1     ISH - S2     144      68.5     144    68.5   1.41#>  8 70417     3 2     0     Elevated     124      57.7     122    57     4.36#>  9 70417     2 2     0     ISH - S1     133      56.5     133    56.5   1.41#> 10 70417     3 2     0     ISH - S2     151      66       151    65     0#> # ℹ 25 more rows#> # ℹ 17 more variables: SD_DBP <dbl>, ARV_SBP <dbl>, ARV_DBP <dbl>,#> #   SV_SBP <dbl>, SV_DBP <dbl>, CV_SBP <dbl>, CV_DBP <dbl>, SBP_max <dbl>,#> #   SBP_min <dbl>, DBP_max <dbl>, DBP_min <dbl>, SBP_range <dbl>,#> #   DBP_range <dbl>, Peak_SBP <dbl>, Peak_DBP <dbl>, Trough_SBP <dbl>,#> #   Trough_DBP <dbl>

Here is an example of thebp_scatter function forsubject 70417:

bp_scatter(hypnos_proc,subj =70417)#> Warning in geom_text(aes(x = min(xlim_breaks) + 5, y = low_y_lim[2], label = "Low"), : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.#> Warning in geom_text(aes(x = min(xlim_breaks) + 5, y = norm_y_lim[2], label = "Normal"), : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.#> Warning in geom_text(aes(x = min(xlim_breaks) + 5, y = 130, label = "Elevated"), : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.#> Warning in geom_text(aes(x = 90, y = 140, label = "S1"), color = "black", : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.#> Warning in geom_text(aes(x = s2_x_lim[2] - 5, y = s2_y_lim[2] - 5, label = "S2"), : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.#> Warning in geom_text(aes(x = min(xlim_breaks) + 5, y = 140, label = "ISH - S1"), : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.#> Warning in geom_text(aes(x = min(xlim_breaks) + 5, y = s2_y_lim[2] - 5, : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.#> Warning in geom_text(aes(x = 90, y = 90, label = "IDH\n S1"), color = "black", : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.#> Warning in geom_text(aes(x = s2_x_lim[2] - 5, y = 90, label = "IDH\n S2"), : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.#> Warning in geom_text(aes(x = xlim_breaks[xlim_breaks_length], y = ylim_breaks[ylim_breaks_length], : All aesthetics have length 1, but the data has 55 rows.#> ℹ Please consider using `annotate()` or provide this layer with data containing#>   a single row.


[8]ページ先頭

©2009-2025 Movatter.jp