View source: R/function_overrides.R View source: R/RcppExports.R
| detect_all_events | R Documentation |
Comprehensive function to detect all types of glycemic events aligned with international consensus CGM metrics (Battelino et al., 2023). This function provides a unified interface for detecting multiple event types including Level 1/2/Extended hypo- and hyperglycemia, and Level 1 excluded events.
detect_all_events(df, reading_minutes = NULL)
df |
A dataframe containing continuous glucose monitoring (CGM) data. Must include columns:
|
reading_minutes |
Time interval between readings in minutes (optional). Can be a single integer/numeric value (applied to all subjects) or a vector matching data length (different intervals per subject) |
A tibble containing comprehensive event analysis with columns:
id: Subject identifier
type: Event type (hypo/hyper)
level: Event level (lv1/lv2/extended/lv1_excl)
total_episodes: Total number of episodes
avg_ep_per_day: Average episodes per day
avg_episode_duration_below_54: Average episode duration below 54 mg/dL in minutes (hypoglycemic events only)
- Hypoglycemia: lv1 (< 70 mg/dL, \geq 15 min), lv2 (< 54 mg/dL, \geq 15 min), extended (< 70 mg/dL, \geq 120 min).
- Hyperglycemia: lv1 (> 180 mg/dL, \geq 15 min), lv2 (> 250 mg/dL, \geq 15 min), extended (> 250 mg/dL, \geq 90 min in 120 min, end \leq 180 mg/dL for \geq 15 min).
Battelino, T., et al. (2023). Continuous glucose monitoring and metrics for clinical trials: an international consensus statement. The Lancet Diabetes & Endocrinology, 11(1), 42-57.
detect_hyperglycemic_events, detect_hypoglycemic_events
# Load sample data
library(iglu)
data(example_data_5_subject)
data(example_data_hall)
# Detect all glycemic events with 5-minute reading intervals
all_events <- detect_all_events(example_data_5_subject, reading_minutes = 5)
print(all_events)
# Detect all events on larger dataset
large_all_events <- detect_all_events(example_data_hall, reading_minutes = 5)
print(paste("Total event types analyzed:", nrow(large_all_events)))
# Filter for specific event types
hyperglycemia_events <- all_events[all_events$type == "hyper", ]
hypoglycemia_events <- all_events[all_events$type == "hypo", ]
print("Hyperglycemia events:")
print(hyperglycemia_events)
print("Hypoglycemia events:")
print(hypoglycemia_events)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.