Nothing
#' Compute Time Inside Range
#'
#' This function computes the time inside range (range in standard
#' deviations from mean, default = 1).
#'
#' @param df Data frame read through readfile
#' @param sd Standard deviation indicating glycemic excursions,
#' default = 1
#' @param sr Sampling rate inverse in minutes of the CGM
#' (default is the Dexcom -> 5 minutes)
#' @return A numeric value representing TIR
#' @examples
#' mydatafile <- system.file("extdata", "my_data_file.csv", package = "cgmquantify")
#' mydata <- readfile(mydatafile)
#' TIR(mydata, sd = 1, sr = 5)
#' @export
#' @import stats
TIR <- function(df, sd = 1, sr = 5) {
up = mean(df$glucose) + sd*sd(df$glucose)
dw = mean(df$glucose) - sd*sd(df$glucose)
TIR = nrow(subset(df, df$glucose <= up & df$glucose >= dw)) * sr
return(TIR)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.