Learn R Programming

⚠️There's a newer version (4.2.2) of this package.Take me there.

iglu

iglu: Interpreting data from Continuous Glucose Monitors (CGMs)

The R package ‘iglu’ provides functions for outputting relevant metrics for data collected from Continuous Glucose Monitors (CGM). For reference, see “Interpretation of continuous glucose monitoring data: glycemic variability and quality of glycemic control.” Rodbard (2009). For more information on the package, see package website.

iglu comes with two example datasets: example_data_1_subject and example_data_5_subject. These data are collected using Dexcom G4 CGM on subjects with Type II diabetes. Each dataset follows the structure iglu’s functions are designed around. Note that the 1 subject data is a subset of the 5 subject data. See the examples below for loading and using the data.

Installation

The R package ‘iglu’ is available from CRAN, use the commands below to install the most recent Github version.

# Plain installation
devtools::install_github("irinagain/iglu") # iglu package

# For installation with vignette
devtools::install_github("irinagain/iglu", build_vignettes = TRUE)

Example

library(iglu)
data(example_data_1_subject) # Load single subject data
## Plot data

# Use plot on dataframe with time and glucose values for time series plot
plot_glu(example_data_1_subject)

# Summary statistics and some metrics
summary_glu(example_data_1_subject)
#> # A tibble: 1 x 7
#> # Groups:   id [1]
#>   id         Min. `1st Qu.` Median  Mean `3rd Qu.`  Max.
#>   <fct>     <dbl>     <dbl>  <dbl> <dbl>     <dbl> <dbl>
#> 1 Subject 1    66        99    112  124.       143   276

in_range_percent(example_data_1_subject)
#> # A tibble: 1 x 4
#>   id        in_range_70_140 in_range_70_180 in_range_80_200
#>   <fct>               <dbl>           <dbl>           <dbl>
#> 1 Subject 1            73.7            91.7            96.0

above_percent(example_data_1_subject, targets = c(80,140,200,250))
#> # A tibble: 1 x 5
#>   id        above_140 above_200 above_250 above_80
#>   <fct>         <dbl>     <dbl>     <dbl>    <dbl>
#> 1 Subject 1      26.7      3.70     0.446     99.4

j_index(example_data_1_subject)
#> # A tibble: 1 x 2
#>   id        j_index
#>   <fct>       <dbl>
#> 1 Subject 1    24.6

conga(example_data_1_subject)
#> # A tibble: 1 x 2
#>   id        conga
#>   <fct>     <dbl>
#> 1 Subject 1  37.0

# Load multiple subject data
data(example_data_5_subject)

plot_glu(example_data_5_subject, plottype = 'lasagna', datatype = 'average')

below_percent(example_data_5_subject, targets = c(80,170,260))
#> # A tibble: 5 x 4
#>   id        below_170 below_260 below_80
#>   <fct>         <dbl>     <dbl>    <dbl>
#> 1 Subject 1      89.6      99.7    0.652
#> 2 Subject 2      17.7      78.9    0    
#> 3 Subject 3      73.5      96.0    0.913
#> 4 Subject 4      91.8     100      2.05 
#> 5 Subject 5      55.3      90.3    1.13

mage(example_data_5_subject)
#> # A tibble: 5 x 2
#>   id         mage
#>   <fct>     <dbl>
#> 1 Subject 1  53.4
#> 2 Subject 2  78.2
#> 3 Subject 3  76.6
#> 4 Subject 4  42.9
#> 5 Subject 5  90.0

Shiny App

The Shiny App can be accessed locally via

library(iglu)
iglu_shiny()

or globally at https://irinagain.shinyapps.io/shiny_iglu/. As new functionality gets added, the local version will be slightly ahead of the global one.

Shiny Demonstration

For a demonstration of the package in a point-and-click interface, click the link below.

https://stevebroll.shinyapps.io/shinyigludemo/

Copy Link

Version

Install

install.packages('iglu')

Monthly Downloads

384

Version

3.0.0

License

GPL-2

Maintainer

Irina Gaynanova

Last Published

July 23rd, 2021

Functions in iglu (3.0.0)

calculate_sleep_wake

Calculate metrics for values inside and/or outside a specified time range.
above_percent

Calculate percentage of values above target thresholds
example_data_1_subject

Example CGM data for one subject with Type II diabetes
episode_calculation

Calculates the number of Hypo/Hyperglycemic events as well as other statistics
cogi

Calculate Continuous Glucose Monitoring Index (COGI) values
conga

Continuous Overall Net Glycemic Action (CONGA)
gmi

Calculate GMI
example_data_5_subject

Example CGM data for 5 subjects with Type II diabetes
hypo_index

Calculate Hypoglycemia Index
igc

Calculate Index of Glycemic Control
hyper_index

Calculate Hyperglycemia Index
ea1c

Calculate eA1C
hist_roc

Plot histogram of Rate of Change values (ROC)
epicalc_profile

Display Episode Calculation statistics for selected subject
grade_hyper

Percentage of GRADE score attributable to hyperglycemia
grade_hypo

Percentage of GRADE score attributable to hypoglycemia
iglu_shiny

Run IGLU Shiny App
in_range_percent

Calculate percentage in targeted value ranges
mage

Calculate Mean Amplitude of Glycemic Excursions
mage_ma_single

Calculates Mean Amplitude of Glycemic Excursions (see "mage")
mad_glu

Calculate Median Absolute Deviation (MAD)
cv_measures

Calculate Coefficient of Variation subtypes
gvp

Calculate Glucose Variability Percentage (GVP)
cv_glu

Calculate Coefficient of Variation (CV) of glucose levels
hbgi

Calculate High Blood Glucose Index (HBGI)
grade_eugly

Percentage of GRADE score attributable to target range
grade

Calculate mean GRADE score
mag

Calculate the Mean Absolute Glucose (MAG)
plot_agp

Plot Ambulatory Glucose Profile (AGP) modal day
%>%

Pipe operator
plot_lasagna

Lasagna plot of glucose values for multiple subjects
lbgi

Calculate Low Blood Glucose Index (LBGI)
mean_glu

Calculate mean glucose level
median_glu

Calculate median glucose level
modd

Calculate mean difference between glucose values obtained at the same time of day (MODD)
plot_ranges

Plot Time in Ranges as a bar plot
plot_lasagna_1subject

Lasagna plot of glucose values for 1 subject aligned across times of day
plot_roc

Plot time series of glucose colored by rate of change
sd_roc

Calculate the standard deviation of the rate of change
sd_measures

Calculate SD subtypes
iqr_glu

Calculate glucose level iqr
j_index

Calculate J-index
roc

Calculate the Rate of Change at each time point (ROC)
sd_glu

Calculate sd glucose level
optimized_iglu_functions

Optimized Calculations of Time Dependent iglu Metrics
range_glu

Calculate glucose level range
read_raw_data

Read raw data from a variety of common sensors.
m_value

Calculate the M-value
plot_daily

Plot daily glucose profiles
plot_glu

Plot time series and lasagna plots of glucose measurements
process_data

Data Pre-Processor
summary_glu

Calculate summary glucose level
quantile_glu

Calculate glucose level quantiles
agp_metrics

Calculate metrics for the Ambulatory Glucose Profile (AGP)
adrr

Calculate average daily risk range (ADRR)
below_percent

Calculate percentage below targeted values
agp

Display Ambulatory Glucose Profile (AGP) statistics for selected subject
CGMS2DayByDay

Interpolate glucose value on an equally spaced grid from day to day
active_percent

Calculate percentage of time CGM was active
all_metrics

Calculate all metrics in iglu
auc

Calculate Area Under Curve AUC