plot_meals: Plot meal metrics visualization

View source: R/plot_meals.R

plot_mealsR Documentation

Plot meal metrics visualization

Description

The function plot_meals produces a visual for meals data

Usage

plot_meals(data, mealtimes, plot_type=c('ggplot','plotly'))

Arguments

data

DataFrame object with column names "id", "time", and "gl". Should only be data for 1 subject. In case multiple subject ids are detected, a warning is produced and only 1st subject is used.

mealtimes

Either a vector of mealtimes, corresponding to data being from a single subject, OR a dataframe with at least 2 columns labeled id and mealtime. Optionally the mealtimes dataframe can include a column labeled meal, giving the meal type (helps to compensate for overlapping meals)

plot_type

Default: "ggplot". One of 'ggplot', 'plotly'. Determines whether the function returns a static publication-ready image or an interactive GUI.

Details

Only a single subject's data may be plotted. The solid black line is the glucose trace. Vertical dashed red lines show the mealtimes, and the horizontal blue lines show the baseline for each meal. Purple triangles are plotted to illustrate the 3 meal_metrics Namely the three vertices show the baseline, peak, and 1hr post-peak recovery. If plot_type = 'plotly', plotly is used to display an interactive visual that allows one to zoom into specific areas of the plot.

Value

Plot to visualize meals data.

Author(s)

Elizabeth Chun

References

Service, F. John. (2013) Glucose Variability, Diabetes 62(5): 1398-1404, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2337/db12-1396")}

See Also

meal_metrics()

Examples


select_subject = example_data_hall[example_data_hall$id == "2133-018", ]
select_meals = example_meals_hall[example_meals_hall$id == "2133-018", ]
plot_meals(select_subject, select_meals)

iglu documentation built on June 22, 2024, 9:28 a.m.