cgmguru: Examples Gallery

knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.width = 10, fig.height = 6, warning = FALSE, message = FALSE)
library(cgmguru)
library(iglu)
library(ggplot2)
library(dplyr)

# Use package root as working directory so we can reference ../examples
pkg_root <- normalizePath("..", winslash = "/", mustWork = TRUE)
examples_dir <- file.path(pkg_root, "/inst/examples")
stopifnot(dir.exists(examples_dir))

Overview

This vignette renders and runs the example scripts provided in the package's /inst/examples/ directory, so you can see inputs, outputs, and typical workflows in one HTML document.

If you are viewing this from RStudio Help, use the "Open in Browser" button for the best experience.

Notes


GRID

source(file.path(examples_dir, "grid.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Detect all events

source(file.path(examples_dir, "detect_all_events.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Detect hyperglycemic events

source(file.path(examples_dir, "detect_hyperglycemic_events.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Detect hypoglycemic events

source(file.path(examples_dir, "detect_hypoglycemic_events.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Excursion

source(file.path(examples_dir, "excursion.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Local maxima

source(file.path(examples_dir, "find_local_maxima.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Max after hours

source(file.path(examples_dir, "find_max_after_hours.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Max before hours

source(file.path(examples_dir, "find_max_before_hours.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Min after hours

source(file.path(examples_dir, "find_min_after_hours.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Min before hours

source(file.path(examples_dir, "find_min_before_hours.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Maxima + GRID combined

source(file.path(examples_dir, "maxima_grid.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Ordering utility

source(file.path(examples_dir, "orderfast.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Start finder

source(file.path(examples_dir, "start_finder.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Transform dataframe

source(file.path(examples_dir, "transform_df.R"), echo = TRUE, print.eval = TRUE, max.deparse.length = Inf)

Function reference and help

For detailed function documentation with additional runnable @examples, see the package reference:

help(package = "cgmguru")

You can also open the package vignettes index:

browseVignettes("cgmguru")


Try the cgmguru package in your browser

Any scripts or data that you put into this service are public.

cgmguru documentation built on Nov. 6, 2025, 1:07 a.m.