build_culture_tree {srppp} | R Documentation |
Build a Culture Tree
Description
Constructs a hierarchical tree structure from a culture description table that is created within the srppp_dm function. As each culture can have one or two parent nodes in an srppp XML file, the nodes with two parent nodes are duplicated. The duplicated nodes retain their primary key as an attribute, so the information on their identity does not get lost.
Usage
build_culture_tree(culture_descriptions)
Arguments
culture_descriptions |
A tibble containing culture descriptions with the following columns:
|
Details
The function builds the culture tree in two main steps:
Node Creation: It first creates all unique culture nodes and adds them to a lookup environment. Each node is initialized with its German name and its
culture_id
.Relationship Establishment: It then establishes parent-child relationships between nodes. Any node that has a second parent culture is duplicated and the duplicate is associated with the second parent culture
Value
A data.tree::Node representing the root of the culture hierarchy. Each node in the tree has the following attributes:
-
name_de
: The German name of the culture (from thede
column). -
name_fr
: The French name of the culture (from thefr
column). -
name_it
: The Italian name of the culture (from theit
column). -
culture_id
: The unique identifier of the culture