| parse_rules_cpp | R Documentation |
'parse_rules_cpp()' is the Rcpp-exposed engine behind parse_rules.
It accepts a data frame of association rules and returns a layout-agnostic
parsed structure consisting of an items table and a rules table.
This function is exported by Rcpp primarily for internal use and testing.
parse_rules_cpp(rules_df)
rules_df |
A data frame with the required columns:
|
Parsing rules
Both LHS and RHS are split on "," or "&" outside of
brackets; leading/trailing whitespace is trimmed.
A single outer brace pair {...} on RHS is stripped if present.
Supported item syntaxes:
Categorical equality: feature = value (value may be quoted).
Numeric interval: feature in [lo, hi], (lo, hi], etc.
Relational: feature >= x, > x, <= x, < x.
For relational items, the unused bound is set to NA.
Fitness is carried through as lift.
A list with two data frames:
itemsColumns:
item_id: integer, 0-based stable ID within this parsed object.
label: original item string.
feature: base feature name.
kind: one of "numeric", "categorical", "set", "unknown".
category_value: categorical value (quotes removed).
lo, hi: numeric bounds (may be NA).
incl_low, incl_high: logical inclusivity flags.
op: one of "<", "<=", ">", ">=", "=", "in".
label_long, label_short: preformatted interval labels.
rulesColumns:
rule_id: 1-based rule index (for display).
support, confidence, lift: rule-level metrics.
lhs_item_ids, rhs_item_ids: list-columns of integer vectors
of 0-based item_ids.
antecedent_length, consequent_length: integer lengths of LHS/RHS.
Throws an error if required columns are missing or have inconsistent lengths.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.