aidR: YourLoops export format

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(aidR)
path <- system.file("extdata", "yourloops_example.zip", package = "aidR")
tmpdir <- file.path(tempdir(), "yourloops_example")
unzip(path, exdir = tmpdir)
files <- list.files(tmpdir, recursive = TRUE)

Overview

A YourLoops export is a folder (possibly zipped) containing CSV files for several data types:

basename(files) # removes yourloops_example/ prefix

The column headers are always in English, regardless of the user's account language. Timestamps are given in UTC alongside a separate timezone offset in minutes, so recovering local (wall-clock) time requires combining the two. This example shows a file containing CGM data:

writeLines(readLines(file.path(tmpdir, files[4]), n = 10))

How aidR detects this format

Because YourLoops headers are language-independent, aidR identifies each file by matching its column names exactly against a lookup of the expected headers for each data type.

Files and the data types they produce

To inspect the raw files, we parse the export with clean = FALSE, which returns the full information provided by YourLoops:

data <- parse_data(id = "1", paths = path, clean = FALSE)

Each entry below describes one raw file and shows an example.

head(data$cgm)
head(data$basal)
head(data$bolus)
head(data$meals)
head(data$rescuecarbs)
head(data$alarms)
head(data$physicalActivities)
head(data$settings_pump)

Note that a YourLoops export contains no SMBG data; cgm, basal, bolus, and carbs are the core data types available from this platform.

Cleaning files

When parse_data is run with clean = TRUE, the cleaned data types are built from the following raw files and attributes:

| Cleaned data type | Used files | Used attributes from clean = FALSE| |-------------------|---------------------------------|-------------------------------------| | cgm | cbg.csv | data$cgm | | basal | basal.csv | data$basal | | bolus | bolus.csv | data$bolus | | carbs | meals.csv, rescuecarbs.csv | data$meals, data$rescuecarbs | | total_basal | basal.csv | data$basal | | total_bolus | bolus.csv | data$bolus |

Notes



Try the aidR package in your browser

Any scripts or data that you put into this service are public.

aidR documentation built on Oct. 28, 2026, 5:13 p.m.