Learn R Programming

QCA (version 0.6-5)

getRow: Get a specific row from a truth table

Description

A truth table is formed by the unique combinations of causal conditions' levels. For binary crisp sets, there are exactly $2^k$ combinations, where $k$ is the number of conditions. This function accepts multiple levels (not just 0 an 1) and its purpose is to transform the decimal representation of a row number into its corresponding combination of levels.

Usage

getRow(noflevels, row.no, zerobased=FALSE)

Arguments

noflevels
a vector containing the number of levels for each causal condition
row.no
a vector, the desired row number(s) from the truth table
zerobased
logical; if TRUE the first row number from the truth table is zero

Value

  • a matrix with the combination of levels corresponding to the desired row number(s)

See Also

createMatrix, expand.grid

Examples

Run this code
# all three conditions are binary, having two levels: 0 and 1
noflevels <- c(2, 2, 2)
getRow(noflevels, 8) # 1 1 1
getRow(noflevels, 0, zerobased=TRUE) # 0 0 0


# the second condition has three levels: 0, 1 and 2
noflevels <- c(2, 3, 2)
getRow(noflevels, 11) # 1 2 0

Run the code above in your browser using DataLab