View source: R/function_overrides.R View source: R/RcppExports.R
| detect_between_maxima | R Documentation |
Identifies and analyzes events occurring between detected maxima points, providing detailed episode information for GRID analysis. This function helps characterize the glucose dynamics between identified peaks.
detect_between_maxima(df, transform_df)
df |
A dataframe containing continuous glucose monitoring (CGM) data. Must include columns:
|
transform_df |
A dataframe containing summary information from previous transformations |
A list containing:
results: Tibble with events between maxima (id, grid_time, grid_gl, maxima_time, maxima_glucose, time_to_peak)
episode_counts: Tibble with episode counts per subject (id, episode_counts)
grid, mod_grid, find_new_maxima, transform_df
Other GRID pipeline:
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(),
mod_grid(),
start_finder(),
transform_df()
# Load sample data
library(iglu)
data(example_data_5_subject)
data(example_data_hall)
# Complete pipeline to get transform_df
grid_result <- grid(example_data_5_subject, gap = 60, threshold = 130)
maxima_result <- find_local_maxima(example_data_5_subject)
mod_result <- mod_grid(example_data_5_subject, grid_result$grid_vector, hours = 2, gap = 60)
max_after <- find_max_after_hours(example_data_5_subject, mod_result$mod_grid_vector, hours = 2)
new_maxima <- find_new_maxima(example_data_5_subject,
max_after$max_indices,
maxima_result$local_maxima_vector)
transformed <- transform_df(grid_result$episode_start, new_maxima)
# Detect events between maxima
between_events <- detect_between_maxima(example_data_5_subject, transformed)
print(paste("Events between maxima:", length(between_events)))
# Analysis on larger dataset
large_grid <- grid(example_data_hall, gap = 60, threshold = 130)
large_maxima <- find_local_maxima(example_data_hall)
large_mod <- mod_grid(example_data_hall, large_grid$grid_vector, hours = 2, gap = 60)
large_max_after <- find_max_after_hours(example_data_hall, large_mod$mod_grid_vector, hours = 2)
large_new_maxima <- find_new_maxima(example_data_hall,
large_max_after$max_indices,
large_maxima$local_maxima_vector)
large_transformed <- transform_df(large_grid$episode_start, large_new_maxima)
large_between <- detect_between_maxima(example_data_hall, large_transformed)
print(paste("Events between maxima in larger dataset:", length(large_between)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.