quantile_glu: Calculate glucose level quantiles

Description Usage Arguments Details Value Examples

View source: R/quantile_glu.R

Description

The function quantile_glu is a wrapper for the base function quantile(). Output is a tibble object with columns for subject id and each of the quantiles.

Usage

1
quantile_glu(data, quantiles = c(0, 25, 50, 75, 100))

Arguments

data

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

quantiles

List of quantile values between 0 and 100.

Details

A tibble object with 1 row for each subject, a column for subject id and a column for each quantile is returned. NA glucose values are omitted from the calculation of the quantiles.

The values are scaled from 0-1 to 0-100 to be consistent in output with above_percent, below_percent, and in_range_percent.

The command quantile_glu(...) / 100 will scale each element down from 0-100 to 0-1.

Value

If a data.frame object is passed, then a tibble object with a column for subject id and then a column for each quantile 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.

Examples

1
2
3
4
5
6
7
8
9

iglu documentation built on July 24, 2021, 1:07 a.m.