flatten_data: Flatten a dataset

Description Usage Arguments Details Value Note Examples

View source: R/flatten_data.R

Description

Flatten a dataset

Usage

1

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

1
2
3
4
5
6
7
8
# 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 Oct. 19, 2021, 1:08 a.m.