Learn R Programming

cgmanalysis (version 2.2)

cgmvariables: Calculate CGM Variables

Description

This function takes cleaned CGM data and returns clinically relevant measures (e.g. percent time spent over 140, MAGE, MODD, etc.).

Usage

cgmvariables(inputdirectory,
outputdirectory = tempdir(),
outputname = "REDCap Upload",
aboveexcursionlength = 35,
belowexcursionlength = 10,
magedef = "1sd",
congan = 1,
daystart = 6,
dayend = 22,
format = "rows")

Arguments

inputdirectory

The directory containing cleaned CSV files for analysis.

outputdirectory

The directory where you would like the results spreadsheet to be written.

outputname

The name of the file containing final CGM variables (without the file extension).

aboveexcursionlength

The number of minutes blood sugar must be above threshold to count an excursion.

belowexcursionlength

The number of minutes blood sugar must be below threshold to count an excursion.

magedef

How large an excursion needs to be in order to count in the MAGE calculation (e.g. greater than 1 standard deviation).

congan

CONGA interval in hours.

daystart

The numeric hour at which daytime should start (e.g. to start counting day time at 6:00am, set daystart = 6).

dayend

The numeric hour at which daytime should end (this parameter uses military time, so to stop counting day time at 10:00pm, set dayend = 22).

format

Whether observations are in rows or columns.

Value

A data frame containing calculated CGM variables, with each column representing one CGM file.

Details

All files must be saved as a csv, and must have three columns, the first of which contains the subject ID in the first cell and date of CGM placement in the second (see example files). The names of the columns must be "subjectid" "timestamp" and "sensorglucose" (without quotes) respectively. Files can be cleaned and formatted using this package's cleandata() function.

Examples

Run this code
# NOT RUN {
cgmvariables(system.file("extdata","Cleaned",package = "cgmanalysis"))
# }

Run the code above in your browser using DataLab