collapseEdges: Collapse Edges

Description Usage Arguments Value

View source: R/collapseEdges.R

Description

This function takes a "edge" data.table (i.e. a data.table with parent/child columns and an extraction rate column) and condenses the parent/child relationships. For example, wheat may be processed into flour which is in turn processed into bread. Thus, we can standardize bread to flour and then the wheat, but it'd be easier to just standardize straight to bread. This function condenses the edges by multiplying the extraction rates so that you can take bread straight to wheat.

Usage

1
2
3
collapseEdges(edges, parentName = "parentID", childName = "childID",
  extractionName = "extractionRate", keyCols = c("timePointYearsSP",
  "geographicAreaFS"))

Arguments

edges

A data.table containing three columns (corresponding to a parent, a child, and an extraction rate).

parentName

The column name of the parent column in edges.

childName

The column name of the child column in edges.

extractionName

The column name of the extraction rate column in edges.

keyCols

The column name(s) of the columns of edges which should be considered as keys. These columns will thus be included in any joins to ensure we don't get duplicates. If there is no key, this can be "".

Value

A data.table of the same structure as edges, but with intermediate steps removed.


SWS-Methodology/faoswsStandardization documentation built on Feb. 7, 2022, 5:05 a.m.