flatten_data: Flatten multi-site MeLiDos data into one table

View source: R/flatten_data.R

flatten_dataR Documentation

Flatten multi-site MeLiDos data into one table

Description

flatten_data() combines the named list returned by load_data() into one tibble and keeps site provenance in a site column.

Usage

flatten_data(melidos_data, tz = "UTC", label_from = 1)

Arguments

melidos_data

A list returned by load_data() for multiple sites.

tz

Time zone to enforce for all POSIXct columns.

label_from

indice of the dataset that is used to apply labels to the output.

Details

If date-time columns are present (POSIXct), their timezone is overwritten using lubridate::force_tz().

Value

A tibble with all rows stacked and a site column.

Examples

example_multi_site <- structure(
  list(
    TUM = data.frame(id = 1, bedtime = as.POSIXct("2024-01-01 22:00:00", tz = "UTC")),
    UCR = data.frame(id = 2, bedtime = as.POSIXct("2024-01-02 22:30:00", tz = "UTC"))
  ),
  class = c("melidos_data", "list")
)

flatten_data(example_multi_site, tz = "Europe/Berlin")

melidosData documentation built on April 22, 2026, 5:09 p.m.