Guards against two behaviors of QCA::truthTable() (observed with QCA 3.25 / admisc 0.40) that can affect programmatic, repeated calls such as threshold sweeps. For sparse truth tables the incl/PRI columns may be returned as character rather than numeric, and logical-remainder rows (observed n = 0) may carry the string "-". Passing such a truth table to QCA::minimize() can, for some truth table structures, cause the minimization to hang or return misleading fit values. This helper coerces incl/PRI to numeric and sets the remainder rows to 0.

sanitize_truthtable(tt)

Arguments

tt

A truth table object returned by QCA::truthTable().

Value

The same object with numeric incl/PRI columns and no NA in those columns. Returns the input unchanged if it is NULL or lacks a $tt data frame.

Details

The OUT column is deliberately left untouched: minimize() uses OUT (with the symbolic "?" for remainders) to identify positive, negative, and remainder rows, so setting incl/PRI to 0 on remainder rows does not alter remainder handling.