| cgmguru-package | R Documentation |
A high-performance R package for comprehensive Continuous Glucose Monitoring (CGM) data analysis with optimized C++ implementations. The package provides advanced tools for CGM data analysis with two primary capabilities: GRID and postprandial peak detection, and extended glycemic events detection aligned with international consensus CGM metrics.
The package implements several key algorithms for CGM analysis:
GRID Algorithm: Detects rapid glucose rate increases (commonly \geq 90–95 mg/dL/hour)
with configurable thresholds and gaps for postprandial peak detection
Postprandial Peak Detection: Finds peak glucose after GRID points using local maxima and configurable time windows
Consensus CGM Metrics Event Detection: Level 1/2 hypo- and hyperglycemia detection with duration validation (default minimum 15 minutes) aligned with Battelino et al. (2023) international consensus
Advanced Analysis Tools: Local maxima finding, excursion analysis, and robust episode validation utilities
Core algorithms are implemented in optimized C++ via 'Rcpp' for accurate and fast analysis on large datasets, making the package suitable for both research and clinical applications.
gridGRID algorithm for detecting rapid glucose rate increases
maxima_gridCombined maxima detection and GRID analysis for postprandial peaks
detect_hyperglycemic_eventsHyperglycemic event detection (Level 1/2/Extended)
detect_hypoglycemic_eventsHypoglycemic event detection (Level 1/2/Extended)
detect_all_eventsComprehensive detection of all glycemic event types
find_local_maximaLocal maxima identification in glucose time series
orderfastFast dataframe ordering utility
Input dataframes should contain:
id: Patient identifier (character or factor)
time: POSIXct timestamps
gl: Glucose values in mg/dL
All function arguments and return values are expected to be in tibble format. For convenience, single-column parameters can be passed as vectors in R, which will be automatically converted to single-column tibbles.
# Basic GRID analysis
result <- grid(cgm_data, gap = 15, threshold = 130)
# Postprandial peak detection (GRID-based)
maxima <- maxima_grid(cgm_data, threshold = 130, gap = 60, hours = 2)
# Level 1 Hyperglycemic event detection
events <- detect_hyperglycemic_events(cgm_data, start_gl = 180,
dur_length = 15, end_length = 15,
end_gl = 180)
# Comprehensive event detection
all_events <- detect_all_events(cgm_data, reading_minutes = 5)
Sang Ho Park shstat1729@gmail.com
Battelino, T., et al. "Continuous glucose monitoring and metrics for clinical trials: an international consensus statement." *The Lancet Diabetes & Endocrinology* 11.1 (2023): 42-57.
Harvey, Rebecca A., et al. "Design of the glucose rate increase detector: a meal detection module for the health monitoring system." *Journal of diabetes science and technology* 8.2 (2014): 307-320.
Chun, E., et al. "iglu: interpreting glucose data from continuous glucose monitors." R package version 3.0 (2023).
For more information about the GRID algorithm and CGM analysis methodologies,
see the package vignette: vignette("intro", package = "cgmguru")
grid, maxima_grid, detect_hyperglycemic_events, detect_all_events
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.