Package 'timbr'

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

Help Index


Coerce to a forest

Description

Coerce to a forest

Usage

as_forest(x, ...)

Arguments

x

An object.

...

Unused, for extensibility.

Value

A forest.


Children of the forest

Description

Convert a forest into a forest consisting of its child nodes.

Usage

children(data, name = NULL)

Arguments

data

A forest.

name

'NULL' (default) or a scalar character specifying the node name of child nodes.

Value

A forest.


Climb a forest from parents to children

Description

Climb a forest from parents to children with one or more node names.

Usage

climb(.data, ..., .recurse = TRUE, .deep)

Arguments

.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?

Value

A forest.


Constructs a forest by one or more variables

Description

'forest_by()' constructs a forest by one or more variables.

Usage

forest_by(.data, ...)

Arguments

.data

A data frame.

...

Variables.

Value

A forest.


Leaf nodes of a forest

Description

Leaf nodes of a forest

Usage

leaves(data)

Arguments

data

A forest.

Value

A forest.


Apply a function hierarchically to a forest

Description

Apply a function hierarchically to a forest in the climbing or descending direction.

Usage

map_forest(.x, .f, ..., .climb = FALSE)

Arguments

.x

A forest

.f

A function, formula, or vector (not necessarily atomic).

...

Additional arguments passed on to the mapped function.

.climb

Climbing or descending?

Value

A forest.


Get node names

Description

Get node names

Usage

node_name()

Value

A character vector.


Get node values

Description

Get node values

Usage

node_value()

Value

A vector.


Apply a function hierarchically to a forest

Description

Apply a function hierarchically to a forest in the climbing or descending direction.

Usage

traverse(.x, .f, ..., .climb = FALSE)

Arguments

.x

A forest

.f

A function, formula, or vector (not necessarily atomic).

...

Additional arguments passed on to the mapped function.

.climb

Climbing or descending?

Value

A forest.