# factorize: Factorize Boolean expressions In QCA: Qualitative Comparative Analysis

## Description

This function finds all combinations of common factors in a Boolean expression written in SOP - Sum Of Products form.

## Usage

 `1` ```factorize(input, snames = "", noflevels = NULL, pos = FALSE, use.tilde = FALSE, ...) ```

## Arguments

 `input` A string containing the SOP expression, or an object of class `"qca"`. `snames` A string containing the sets' names, separated by commas. `noflevels` Numerical vector containing the number of levels for each set. `pos` Logical, if possible factorize using product(s) of sums. `use.tilde` Logical, use a tilde to negate the sets. `...` Other arguments (mainly for backwards compatibility).

## Details

Factorization is a process of finding common factors in a Boolean expression, written in a SOP - sum of products (or DNF - disjunctive normal form). Whenever possible, the factorization can also be performed in a POS - product of sums form.

Conjunctions should preferably be indicated with a star `*` sign, but this is not necessary when conditions have single letters or when the expression is expressed in multi-value notation.

The argument `snames` is only needed when conjunctions are not indicated by any sign, and the set names have more than one letter each (see function `translate()` for more details).

The number of levels in `noflevels` is needed only when negating multivalue conditions, and it should complement the `snames` argument.

If `input` is an object of class `"qca"` (the result of the `minimize()` function), a factorization is performed for each of the minimized solutions.

The argument `use.tilde` is automatically activated if the input contains a tilde to negate conditions.

## Value

A list with two components:

 initial The input expression. factored All possible factorizations of the input expression.

## References

Ragin, C.C. (1987) The Comparative Method. Moving beyond qualitative and quantitative strategies, Berkeley: University of California Press

`translate`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27``` ```# typical example with redundant conditions factorize("AbcD + AbCd + AbCD + ABCd") # results presented in alphabetical order factorize("one*TWO*four + one*THREE + THREE*four") # to preserve a certain order of the set names factorize("one*TWO*four + one*THREE + THREE*four", snames = "ONE, TWO, THREE, FOUR") factorize("~ONE*TWO*~FOUR + ~ONE*THREE + THREE*~FOUR", snames = "ONE, TWO, THREE, FOUR") # using pos - products of sums factorize("ac + aD + bc + bD", pos = TRUE) # using an object of class "qca" produced with minimize() data(CVF) pCVF <- minimize(CVF, outcome = "PROTEST", incl.cut = 0.8, include = "?", use.letters = TRUE) factorize(pCVF) # using an object of class "deMorgan" produced with negate() factorize(negate(pCVF)) ```