Skip to contents

The function active_percent produces

Usage

active_percent(data, dt0 = NULL)

Arguments

data

DataFrame object with column names "id", "time", and "gl".

dt0

The time frequency for interpolated aligned grid in minutes, the default will match the CGM meter's frequency (e.g. 5 min for Dexcom).

Value

If a data.frame object is passed, then a tibble object with five columns: subject id, corresponding active_percent value, duration of measurement period in days, start date, and end date.

Details

The function active_percent produces a tibble object with values equal to the percentage of time the CGM was active, the total number of observed days, the start date and the end date. For example, if a CGM's (5 min frequency) times were 0, 5, 10, 15 and glucose values were missing at time 5, then percentage of time the CGM was active is 75 The output columns correspond to the subject id, the percentage of time for which the CGM was active, the number of days of measurements, the start date and the end date of measurements. The output rows correspond to the subjects. The values of above_percent are always between 0

References

Danne et al. (2017) International Consensus on Use of Continuous Glucose Monitoring Diabetes Care 40 .1631-1640, doi:10.2337/dc17-1600 .

Author

Pratik Patel, Irina Gaynanova

Examples


data(example_data_1_subject)

active_percent(example_data_1_subject)
#> # A tibble: 1 × 5
#>   id        active_percent ndays     start_date          end_date           
#>   <fct>              <dbl> <drtn>    <dttm>              <dttm>             
#> 1 Subject 1           79.8 12.7 days 2015-06-06 16:50:27 2015-06-19 08:59:36

data(example_data_5_subject)

active_percent(example_data_5_subject)
#> # A tibble: 5 × 5
#>   id        active_percent ndays     start_date          end_date           
#>   <fct>              <dbl> <drtn>    <dttm>              <dttm>             
#> 1 Subject 1           79.8 12.7 days 2015-06-06 16:50:27 2015-06-19 08:59:36
#> 2 Subject 2           58.9 16.7 days 2015-02-24 17:31:29 2015-03-13 09:38:01
#> 3 Subject 3           92.1  5.8 days 2015-03-10 15:36:26 2015-03-16 10:11:05
#> 4 Subject 4           98.7 12.9 days 2015-03-13 12:44:09 2015-03-26 10:01:58
#> 5 Subject 5           95.8 10.6 days 2015-02-28 17:40:06 2015-03-11 08:04:28
active_percent(example_data_5_subject, dt0 = 5)
#> # A tibble: 5 × 5
#>   id        active_percent ndays     start_date          end_date           
#>   <fct>              <dbl> <drtn>    <dttm>              <dttm>             
#> 1 Subject 1           79.8 12.7 days 2015-06-06 16:50:27 2015-06-19 08:59:36
#> 2 Subject 2           58.9 16.7 days 2015-02-24 17:31:29 2015-03-13 09:38:01
#> 3 Subject 3           92.1  5.8 days 2015-03-10 15:36:26 2015-03-16 10:11:05
#> 4 Subject 4           98.7 12.9 days 2015-03-13 12:44:09 2015-03-26 10:01:58
#> 5 Subject 5           95.8 10.6 days 2015-02-28 17:40:06 2015-03-11 08:04:28