Learn R Programming

TSQCA (version 1.0.0)

extract_terms: Extract and format terms from solutions

Description

Extracts individual terms from solution expressions and returns formatted unique terms.

Usage

extract_terms(solutions, var_names, use_tilde = TRUE)

Value

List with:

  • all_terms — all terms (with duplicates)

  • unique_terms — unique terms

  • n_total — total term count

  • n_unique — unique term count

Arguments

solutions

Character vector. Solution expressions.

var_names

Character vector. Variable names used in the analysis.

use_tilde

Logical. If TRUE, negation is represented as ~VAR.

Examples

Run this code
var_names <- c("X1", "X2", "X3")
solutions <- c("X1*X2 + X3", "X1*X2 + X1*X3")
extract_terms(solutions, var_names)

Run the code above in your browser using DataLab