plot_intervention: Plot Intervention Over Time

View source: R/food_by_meal.R

plot_interventionR Documentation

Plot Intervention Over Time

Description

This function generates a plot of glucose responses over time, showing vertical bars representing the range of glucose values for each time point. The bars are color-coded based on whether the meal includes the specified intervention.

Usage

plot_intervention(foodresults = NULL, intervention = "glucotrojan")

Arguments

foodresults

A data frame containing the glucose measurements. This is typically generated by calling food_times_df with a valid object created by cgm_data and a 'foodname' string. The dataframe should contain columns named 't', 'value', 'meal', and 'control'. 't' should be the time measurements. 'value' should be the glucose measurements. 'meal' identifies unique meals. 'control' is a logical indicating whether an intervention was applied. If this parameter is NULL, the function will return NULL.

intervention

A string representing the intervention (e.g., "glucotrojan"). The function will check whether each meal includes this intervention.

Value

A ggplot2 object representing the glucose response plot. The plot can be further customized using additional ggplot2 functions.


personalscience/cgmr documentation built on July 2, 2023, 12:47 a.m.