View source: R/function_overrides.R View source: R/RcppExports.R
| find_local_maxima | R Documentation |
Identifies local maxima (peaks) in glucose concentration time series data. Uses a difference-based algorithm to detect peaks where glucose values increase or remain constant for two consecutive points before the peak point, and decrease or remain constant for two consecutive points after the peak point.
find_local_maxima(df)
df |
A dataframe containing continuous glucose monitoring (CGM) data. Must include columns:
|
A list containing:
local_maxima_vector: Tibble with R-based (1-indexed) row numbers of local maxima (local_maxima). The corresponding occurrence time is df$time[local_maxima] and glucose is df$gl[local_maxima].
merged_results: Tibble with local maxima details (id, time, gl)
grid, mod_grid, find_new_maxima
Other GRID pipeline:
detect_between_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)
# Find local maxima
maxima_result <- find_local_maxima(example_data_5_subject)
print(paste("Found", nrow(maxima_result$local_maxima_vector), "local maxima"))
# Find maxima on larger dataset
large_maxima <- find_local_maxima(example_data_hall)
print(paste("Found", nrow(large_maxima$local_maxima_vector), "local maxima in larger dataset"))
# View first few maxima
head(maxima_result$local_maxima_vector)
# View merged results
head(maxima_result$merged_results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.