decompose: Get decomposing nodes

Description Usage Arguments Details Value Note Examples

View source: R/decompose.R

Description

Get attribute values from the nodes that are decomposing a node (e.g. the growing units decomposing an axis).

Usage

1
2
3
4
5
6
7
8
9
decompose(
  attribute,
  node = NULL,
  decomp_type = c("symbol", "scale"),
  scale = NULL,
  symbol = NULL,
  link = NULL,
  filter_fun = NULL
)

Arguments

attribute

Any node attribute (as a character)

node

The MTG node

decomp_type

Match the node scale or symbol for decomposition ? If symbol, the function will return all descendants until matching the same symbol than the node, if scale it will do the same until matching the same scale.

scale

An integer vector for filtering the .scale of the decomposing nodes (i.e. the SCALE column from the MTG classes).

symbol

A character vector for filtering the decomposing nodes by the name of their .symbol (i.e. the SYMBOL column from the MTG classes).

link

A character vector for filtering the .link with the descendant.

filter_fun

Any filtering function taking a node as input.

Details

This function is mainly used to summarize attributes at a higher scale when they were measured at a lower scale. For example we can think of an mtg where the length was measured at the internode scale only, so this function can be used to summarize it at e.g. axis scale. The filters are used to get the nodes of interest only. For example an axis can be made of internodes and leaves, but the length of an axis is made from the cumulative length of the internodes only (not the leaves). A second example would be to summarize the total leaf area per axis, where we would only want to use the area of the leaves (not the internodes).

Value

The attribute values from the nodes decomposing the input node

Note

This function is mainly intended to be used with mutate_mtg(). In this case, the node argument can be left empty (or you can put node = node equivalently).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
filepath= system.file("extdata", "simple_plant_3.mtg", package = "XploRer")
MTG = read_mtg(filepath)

decompose(".symbol", node = extract_node(MTG,"node_3"), decomp_type = "symbol")

# using filters to remove nodes that we don't need:
decompose(".symbol", node = extract_node(MTG,"node_3"), symbol = "Internode",
          decomp_type = "symbol")

# We can check the function worked properly by printing the symbols of each nodes:
print(MTG, ".symbol")

VEZY/XploRer documentation built on Oct. 9, 2021, 10:05 p.m.