above_percent: Calculate percentage of values above target thresholds

View source: R/above_percent.R

above_percentR Documentation

Calculate percentage of values above target thresholds

Description

The function above_percent produces a tibble object with values equal to the percentage of glucose measurements above target values. The output columns correspond to the subject id followed by the target values and the output rows correspond to the subjects. The values will be between 0 (no measurements) and 100 (all measurements).

Usage

above_percent(data, targets_above = c(140, 180, 250))

Arguments

data

DataFrame object with column names "id", "time", and "gl", or numeric vector of glucose values.

targets_above

Numeric vector of glucose thresholds. Glucose values from data argument will be compared to each value in the targets_above vector. Default list is (140, 180, 250).

Details

A tibble object with 1 row for each subject, a column for subject id and column for each target value is returned. NA's will be omitted from the glucose values in calculation of percent.

Value

If a data.frame object is passed, then a tibble object with a column for subject id and then a column for each target value is returned. If a vector of glucose values is passed, then a tibble object without the subject id is returned. as.numeric() can be wrapped around the latter to output a numeric vector.

References

Rodbard (2009) Interpretation of continuous glucose monitoring data: glycemic variability and quality of glycemic control, Diabetes Technology and Therapeutics 11 .55-67, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1089/dia.2008.0132")}.

See Also

plot_ranges()

Examples


data(example_data_1_subject)

above_percent(example_data_1_subject)
above_percent(example_data_1_subject, targets_above = c(100, 150, 180))

data(example_data_5_subject)

above_percent(example_data_5_subject)
above_percent(example_data_5_subject, targets_above = c(70, 170))


iglu documentation built on Oct. 20, 2023, 5:07 p.m.