View source: R/function_overrides.R View source: R/RcppExports.R
| mod_grid | R Documentation |
Constructs a modified GRID series by reapplying the GRID logic with a designated gap (e.g., 60 minutes) and analysis window in hours (e.g., 2 hours). It reassigns GRID events under these constraints to produce a modified grid suitable for downstream maxima mapping and episode analysis.
mod_grid(df, grid_point_df, hours = 2, gap = 15)
df |
A dataframe containing continuous glucose monitoring (CGM) data. Must include columns:
|
grid_point_df |
A dataframe with column |
hours |
Time window in hours for analysis (default: 2) |
gap |
Gap threshold in minutes for event detection (default: 15). This parameter defines the minimum time interval between consecutive GRID events. |
A list containing:
mod_grid_vector: Tibble with modified GRID results (mod_grid)
episode_counts: Tibble with episode counts per subject (id, episode_counts)
episode_start: Tibble with all episode starts with columns:
id: Subject identifier
time: Timestamp at which the event occurs; equivalent to df$time[index]
gl: Glucose value at the event; equivalent to df$gl[index]
index: R-based (1-indexed) row number(s) in df denoting where the event occurs
- gap is minutes; hours is hours; time is POSIXct.
Park, Sang Ho, et al. "Identification of clinically meaningful automatically detected postprandial glucose excursions in individuals with type 1 diabetes using personal continuous glucose monitoring." Diabetes Research and Clinical Practice (2025): 112951.
Park, Soojin, et al. "High-Amplitude and Prolonged Glucose Excursions as a Key Determinant of Discordance Between Glucose Management Indicator and Glycated Hemoglobin in Type 1 Diabetes." Diabetes Care (2026): dc252820. https://doi.org/10.2337/dc25-2820
grid, find_max_after_hours, find_new_maxima
Other GRID pipeline:
detect_between_maxima(),
find_local_maxima(),
find_max_after_hours(),
find_max_before_hours(),
find_min_after_hours(),
find_min_before_hours(),
find_new_maxima(),
grid(),
maxima_grid(),
start_finder(),
transform_df()
# Load sample data
library(iglu)
data(example_data_5_subject)
data(example_data_hall)
# First, get grid points
grid_result <- grid(example_data_5_subject, gap = 60, threshold = 130)
# Perform modified GRID analysis
mod_result <- mod_grid(example_data_5_subject, grid_result$grid_vector, hours = 2, gap = 60)
print(paste("Modified grid points:", nrow(mod_result$mod_grid_vector)))
# Modified analysis with different parameters
mod_result_1h <- mod_grid(example_data_5_subject, grid_result$grid_vector, hours = 1, gap = 40)
# Analysis on larger dataset
large_grid <- grid(example_data_hall, gap = 60, threshold = 130)
large_mod_result <- mod_grid(example_data_hall, large_grid$grid_vector, hours = 2, gap = 60)
print(paste("Modified grid points in larger dataset:", nrow(large_mod_result$mod_grid_vector)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.