build_layout_cpp: Entry point for R to generate coral plot data from a set of...

View source: R/RcppExports.R

build_layout_cppR Documentation

Entry point for R to generate coral plot data from a set of association rules.

Description

This function takes a list of parsed association rules and produces two data frames: one for the nodes and one for the edges of a coral plot. It acts as a wrapper that:

  • Constructs the coral layout.

  • Converts the resulting nodes and edges into R-compatible data frames.

Usage

build_layout_cpp(parsed, grid_size, lhs_sort = "confidence")

Arguments

parsed

A list as returned by 'parse_rules()', with components:

  • items: data.frame with at least item_id (integer, 0-based) and label (character).

  • rules: data.frame with at least rule_id (integer), support, confidence, lift (numeric), and list-columns lhs_item_ids, rhs_item_ids containing 0-based integer vectors.

grid_size

Integer; number of grid cells per layout side used to place corals on a near-square grid (e.g., 3 means a 3×3 canvas)

lhs_sort

Character; metric used to sort antecedent items within each LHS path when building the layout. One of "confidence", "support", "lift" (default "confidence"). Sorting is applied in descending order of the chosen metric.

Value

A List containing two DataFrames:

  • edges: DataFrame with start and end coordinates, line width, and color for each edge.

  • nodes: DataFrame with position, radius, ID, and item label for each node.


niarules documentation built on Sept. 15, 2025, 5:08 p.m.