---
title: "excursion function"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{excursion function}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", warning = FALSE, message = FALSE)
library(cgmguru)
library(iglu)
```

# excursion

## Overview
Calculates glucose excursions: >70 mg/dL rise within 2 hours, not preceded by a value <70 mg/dL.

## Inputs
- **df**: CGM dataframe with `id`, `time` (POSIXct), `gl` (mg/dL)
- **gap**: Minimum minutes separating excursions (default 15)

## Returns
- **excursion_vector**: Logical/int vector marking excursions
- **episode_counts**: Counts per `id`
- **episode_start**: Starts with `id`, `time`, `gl`, `index`

## Run documented examples
```{r}
example(excursion, package = "cgmguru", run.dontrun = FALSE)
```


