DeMorgan: Negate Boolean Expressions using De Morgan's Laws

Description Usage Arguments Details Value Contributors Author(s) References See Also Examples

View source: R/DeMorgan.R

Description

This function negates simple or complex Boolean expressions using the two De Morgan Laws.

Usage

1
2
3
DeMorgan(expression, and.split = "", use.tilde = FALSE)

is.DeMorgan(x)

Arguments

expression

A string representing a Boolean expression or a solution object of class 'qca'.

and.split

The AND-operator (if any).

use.tilde

Logical, use '~' for negation with bivalent variables.

x

An object of class 'DeMorgan'.

Details

The two De Morgan laws posit that the negation of a disjunction is the conjunction of its separate negations, and the negation of a conjunction is the disjunction of its separate negations (Hohn 1966, p.80).

The argument expression can be any complex string representing a Boolean expression of disjunctions and conjunctions, or a solution object of class 'qca' (objects returned by the 'eQMC' function).

Value

A list of solutions with their negations as components if expression is an object of class 'qca', or simply a list with the following components if expression is a string:

initial

The initial expression.

negated

The negation of the initial expression.

Contributors

Dusa, Adrian: development, programming, testing
Thiem, Alrik: development, documentation, testing

Author(s)

Alrik Thiem (Personal Website; ResearchGate Website)

References

Hohn, Franz E. 1966. Applied Boolean Algebra: An Elementary Introduction. 2nd ed. New York: Macmillan.

Ragin, Charles C. 1987. The Comparative Method: Moving beyond Qualitative and Quantitative Strategies. Berkeley: University of California Press.

See Also

eQMC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# example from Ragin (1987, p.99)
DeMorgan("AC + B~C")

# with different AND-operators
DeMorgan("A*C + B*~C", and.split = "*")
DeMorgan("A&C + B&~C", and.split = "&")

# use solution object of class 'qca' returned by 'eQMC' function, 
# even with multiple models
data(d.represent)
KRO.ps <- eQMC(d.represent, outcome = "WNP")
DeMorgan(KRO.ps)

Example output

Please cite the 'QCApro' package as follows:

  Thiem, Alrik. 2016. Professional Functionality for Performing and
  Evaluating Qualitative Comparative Analysis. R Package Version 1.1-1.
  URL: http://www.alrik-thiem.net/software/.

A BibTeX entry can be generated by:

  citation(package = "QCApro")

All improvements and bug fixes on the predecessor package QCA 1.1-4
as well as all internal package changes can be browsed by:

  news(package = "QCApro")

NOTE: As some function and object names currently overlap with the QCAGUI
package, you should work with only either QCApro or QCAGUI within one R session.


S1: AC + B~C 
N1: ~A~B + ~AC + ~B~C 


S1: A*C + B*~C 
N1: ~A*~B + ~A*C + ~B*~C 


S1: A&C + B&~C 
N1: ~A&~B + ~A&C + ~B&~C 


S1: WS + ES*WM + QU*LP + es*LP 
N1: es*lp*ws + ES*qu*wm*ws + lp*wm*ws 

S2: WS + ES*WM + QU*LP + WM*LP 
N2: es*lp*ws + qu*wm*ws + lp*wm*ws 

QCApro documentation built on May 1, 2019, 10:09 p.m.

Related to DeMorgan in QCApro...