| sensor_wear | R Documentation |
Calculates the percent of expected CGM readings observed. By default, the
calculation uses each subject's original timestamp span from first valid
reading to last valid reading. If ndays is supplied, valid readings
in [end_date - ndays, end_date] are divided by the expected number of
readings over that fixed retrospective window.
For fixed-window calculations, if end_date = NULL, each subject's last
valid timestamp defines that subject's retrospective window. If end_date
is supplied, the same endpoint is used for all subjects, which is useful for a
common study cutoff or report date. Duplicate timestamps within a subject are
de-duplicated after sorting, and rows with missing time or gl
do not count as observed readings.
sensor_wear(df, end_date = NULL, ndays = NULL,
reading_minutes = NULL)
df |
A dataframe containing CGM data with columns:
|
end_date |
End timestamp for a fixed-window calculation. Requires
|
ndays |
Number of days in the fixed retrospective window. Defaults to
|
reading_minutes |
Reading interval in minutes. If |
A tibble with columns id, sensor_wear_percent,
sensor_wear, ndays, start_date, and
end_date. sensor_wear is retained as a backward-compatible
alias.
detect_all_events, iglu::active_percent
library(iglu)
data(example_data_5_subject)
sensor_wear(example_data_5_subject, reading_minutes = 5)
sensor_wear(example_data_5_subject, ndays = 90, reading_minutes = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.