merge_all: Merge data available for all individuals, separately per data...

View source: R/03_merge_all.R

merge_allR Documentation

Merge data available for all individuals, separately per data type

Description

Merge data available for all individuals, separately per data type

Usage

merge_all(
  data,
  types = c("cgm", "basal", "bolus", "carbs", "SMBG", "total_basal", "total_bolus")
)

Arguments

data

A named list with the data of each individual (the output of parse_data), named by participant identifier.

types

A character vector with the data type names to be merged. Defaults to the five standardized types and the two daily insulin totals.

Value

A named list with one data frame per data type, holding the data of all individuals. Individuals without data of a given type contribute no rows.

Examples

all_data <- list(
  "1" = parse_data("1", system.file("extdata", "glooko_example.zip", package = "aidR")),
  "2" = parse_data("2", system.file("extdata", "dexcom_clarity_example.csv", package = "aidR"))
)
combined <- merge_all(all_data)
names(combined)
head(combined$cgm)
table(combined$cgm$id)

# Merge CGM data only
merge_all(all_data, types = "cgm")

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