`cgm` is a derived dataset created from [`raw_cgm`], where glucose values are **linearly interpolated** for **short gaps** while **longer gaps remain missing**.
Format
A tibble with the following columns:
- id
Character. Participant ID (
"P01","P02").- cgm_timestamp
POSIXct. CGM timestamp in UTC at 1‑minute intervals.
- glucose
Numeric. Glucose concentration in mmol/L. Observed values where available;
NAin gaps ≥ 30 minutes; linearly interpolated in gaps < 30 minutes.
Source
Generated by data-raw/derive_cgm_from_raw.R using:
cgm <- hypometrics::cgmInterpolate(
raw_cgm,
Interpolate = TRUE,
MinGap = 600, # only act when gaps are at least 10 minutes
Granularity = 300, # 5-minute target grid <-- IMPORTANT
MaxGap = 1800 # interpolate gaps < 30 minutes; leave >= 30 as NA
)Details
The dataset is generated by
hypometrics::cgmInterpolate() as follows:
Input: [`raw_cgm`].
Explicit gaps: Gaps are first made explicit when transforming to the target grid (5‑minute).
Interpolation: Linear interpolation is applied to gaps whose duration is strictly less than 30 minutes (
MaxGap = 1800seconds).Long gaps: Gaps ≥ 30 minutes are not interpolated; glucose remains
NA.Granularity: The target resolution is 5 minutes (
Granularity = 300seconds).
This procedure retains the two synthetic participants from [`raw_cgm`]
(IDs "P01", "P02"), their distinct profiles, and their
hypoglycaemia patterns, while providing a regularised 5‑minute time series
that is convenient for summaries, visualisation, and episode detection.
Examples
data(cgm, package = "hypometrics")
# Structure
dplyr::glimpse(cgm)
#> Rows: 8,063
#> Columns: 3
#> $ id <chr> "P01", "P01", "P01", "P01", "P01", "P01", "P01", "P01", …
#> $ cgm_timestamp <dttm> 2026-01-01 07:22:00, 2026-01-01 07:27:00, 2026-01-01 07…
#> $ glucose <dbl> 6.46, 6.00, 7.06, 7.63, 6.99, 6.81, 6.26, 6.69, 6.74, 6.…
