View source: R/function_overrides.R View source: R/RcppExports.R
| find_new_maxima | R Documentation |
Identifies new maxima in the vicinity of previously identified grid points, useful for refining maxima detection in GRID analysis. This function helps improve the accuracy of peak detection by searching around known event points.
find_new_maxima(df, mod_grid_max_point_df, local_maxima_df)
df |
A dataframe containing continuous glucose monitoring (CGM) data. Must include columns:
|
mod_grid_max_point_df |
A dataframe with column |
local_maxima_df |
A dataframe with column |
A tibble with updated maxima information containing columns (id, time, gl, indices)
The indices column contains R-based (1-indexed) row number(s) in df; thus, time == df$time[indices] and gl == df$gl[indices].
find_local_maxima, find_max_after_hours, transform_df
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(),
grid(),
maxima_grid(),
mod_grid(),
start_finder(),
transform_df()
# Load sample data
library(iglu)
data(example_data_5_subject)
data(example_data_hall)
# First, get grid points and local maxima
grid_result <- grid(example_data_5_subject, gap = 15, threshold = 130)
maxima_result <- find_local_maxima(example_data_5_subject)
# Create modified grid points (simplified for example)
mod_grid_indices <- data.frame(indices = grid_result$episode_start$indices[1:10])
# Find new maxima around grid points
new_maxima <- find_new_maxima(example_data_5_subject,
mod_grid_indices,
maxima_result$local_maxima_vector)
print(paste("Found", nrow(new_maxima), "new maxima"))
# Analysis on larger dataset
large_grid <- grid(example_data_hall, gap = 15, threshold = 130)
large_maxima <- find_local_maxima(example_data_hall)
large_mod_grid <- data.frame(indices = large_grid$episode_start$indices[1:20])
large_new_maxima <- find_new_maxima(example_data_hall,
large_mod_grid,
large_maxima$local_maxima_vector)
print(paste("Found", nrow(large_new_maxima), "new maxima in larger dataset"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.