Title: | Forest/Tree Data Frames |
---|---|
Description: | Provides data frames for forest or tree data structures. You can create forest data structures from data frames and process them based on their hierarchies. |
Authors: | Mizuki Uchida [aut, cre] |
Maintainer: | Mizuki Uchida <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.2.9000 |
Built: | 2024-11-19 05:41:29 UTC |
Source: | https://github.com/uchidamizuki/timbr |
Coerce to a forest
as_forest(x, ...)
as_forest(x, ...)
x |
An object. |
... |
Unused, for extensibility. |
A forest.
Convert a forest into a forest consisting of its child nodes.
children(data, name = NULL)
children(data, name = NULL)
data |
A forest. |
name |
'NULL' (default) or a scalar character specifying the node name of child nodes. |
A forest.
Climb a forest from parents to children with one or more node names.
climb(.data, ..., .recurse = TRUE, .deep)
climb(.data, ..., .recurse = TRUE, .deep)
.data |
A forest. |
... |
A list of node names to climb the forest. |
.recurse |
Whether to search recursively by node names or not? |
.deep |
(Deprecated) Whether to search recursively by node names or not? |
A forest.
'forest_by()' constructs a forest by one or more variables.
forest_by(.data, ...)
forest_by(.data, ...)
.data |
A data frame. |
... |
Variables. |
A forest.
Leaf nodes of a forest
leaves(data)
leaves(data)
data |
A forest. |
A forest.
Apply a function hierarchically to a forest in the climbing or descending direction.
map_forest(.x, .f, ..., .climb = FALSE)
map_forest(.x, .f, ..., .climb = FALSE)
.x |
A forest |
.f |
A function, formula, or vector (not necessarily atomic). |
... |
Additional arguments passed on to the mapped function. |
.climb |
Climbing or descending? |
A forest.
Apply a function hierarchically to a forest in the climbing or descending direction.
traverse(.x, .f, ..., .climb = FALSE)
traverse(.x, .f, ..., .climb = FALSE)
.x |
A forest |
.f |
A function, formula, or vector (not necessarily atomic). |
... |
Additional arguments passed on to the mapped function. |
.climb |
Climbing or descending? |
A forest.