Learn R Programming

QCA (version 1.1-2)

factorize: Factorize Set-Theoretic Expressions

Description

This function finds all possibilities for factorizing a set-theoretic expression.

Usage

factorize(expression, prod.split = "", sort.factorizing = FALSE, 
          sort.factorized = FALSE)

Arguments

expression
A string representing a set-theoretic expression or a solution object of class "qca".
prod.split
The intersection (product) operator (if any).
sort.factorizing
Logical, sort results beginning with largest number of factorizing sets.
sort.factorized
Logical, sort results beginning with largest number of factorized sets.

Value

  • A list with the following components:
  • initialThe initial expression.
  • factoredThe factorizations of the initial expression.

Details

In set theory, the intersection operator "*" is distributive over the union operator "+" such that for any three sets $a$, $b$ and $c$, the following law holds: $(a*b) + (a*c) = a*(b + c)$ (Hohn 1966, pp.78-80; South 1974, p.12). The factorize() function finds all possible sets $a$ for any set-theoretic expression. Factorized versions of the initial expression(s) can be sorted in decreasing order by the number of factorizing sets or in decreasing order by the number of factorized sets.

References

Hohn, Franz E. 1966. Applied Boolean Algebra: An Elementary Introduction. 2nd ed. New York: Macmillan. South, G. F. 1974. Boolean Algebra and Its Uses. New York: Van Nostrand Reinhold.

See Also

eqmcc

Examples

Run this code
# factorize a union of intersections;
# if single letters are used, argument "prod.split" is not needed
factorize("AB + AC")

# but "prod.split" is needed in these cases
factorize("one*TWO*four + one*THREE + THREE*four", prod.split = "*")
factorize("~ONE*TWO*~FOUR + ~ONE*THREE + THREE*~FOUR", prod.split = "*")
factorize("one&TWO&four + one&THREE + THREE&four", prod.split = "&")

# factorize solution objects directly
data(d.HK)
HK.sol <- eqmcc(d.HK, outcome = "PB", conditions = c("C", "F", "T", "V"), 
  include = c("?"))
factorize(HK.sol)

data(d.Emm)
Emm.sol <- eqmcc(d.Emm, outcome = "JSR", incl.cut1 = 0.9)
factorize(Emm.sol)

# sort by the largest number of factoring sets
factorize(Emm.sol, sort.factorizing = TRUE)

# sort by the largest number of factorized sets
factorize(Emm.sol, sort.factorized = TRUE)

Run the code above in your browser using DataLab