powered by
Calculate area under the curve (AUC)
cgm_auc(x, times, thresh = 100, above = TRUE)
The numeric area under the curve value for a given dataset of glucose measurements and times.
vector of glucose readings
vector of corresponding times, in minutes
threshold above (or below) which you wish to calculate the AUC. Default is 100.
logical indicating whether you wish to calculate area above the threshold value (TRUE) or below it (FALSE). Default is TRUE.
cgm_auc(x=c(rep(100, 10), rep(120, 10), 105, 85), times=seq(0, 1260, 60), thresh=110, above=TRUE)
Run the code above in your browser using DataLab