flatten_data: Flatten a dataset

View source: R/flatten_data.R

flatten_dataR Documentation

Flatten a dataset

Description

Flatten a dataset

Usage

flatten_data(data)

Arguments

data

(list) The dataset object returned by read_data(), or a named list of ecocoomDP tables.

Details

The "flat" format refers to the fully joined source L0 dataset in "wide" form with the exception of the core observation variables, which are in "long" form (i.e. using the variable_name, value, unit columns of the observation table). This "flat" format is the "widest" an L1 ecocomDP dataset can be consistently spread due to the frequent occurrence of L0 source datasets with > 1 core observation variable.

Value

(tbl_df, tbl, data.frame) A single flat table created by joining and spreading all tables, except the observation table. See details for more information on this "flat" format.

Note

Warnings/Errors from flatten_data() can most often be fixed by addressing any validation issues reported by read_data() (e.g. non-unique composite keys).

Ancillary identifiers are dropped from the returned object.

Examples

# Flatten a dataset object
flat <- flatten_data(ants_L1)
flat

# Flatten a list of tables
tables <- ants_L1$tables
flat <- flatten_data(tables)
flat


ecocomDP documentation built on Sept. 11, 2024, 6:58 p.m.