# NOT RUN {
translate("A + B*C")
# same thing in multivalue notation
translate("A{1} + B{1}*C{1}")
# using upper/lower letters
translate("A + b*C")
# the negation with tilde is recognised
translate("~A + b*C")
# even in combination of upper/lower letters
translate("~A + ~b*C")
# and even for multivalue variables
# in multivalue notation, the product sign * is redundant
translate("C{1} + T{2} + T{1}V{0} + C{0}")
# negation of multivalue sets requires the number of levels
translate("~A{1} + ~B{0}*C{1}", noflevels = c(2, 2, 2))
# multiple values can be specified
translate("C{1} + T{1,2} + T{1}V{0} + C{0}")
# or even negated
translate("C{1} + ~T{1,2} + T{1}V{0} + C{0}", snames = "C, T, V", noflevels = c(2,3,2))
# if the expression does not contain the product sign *
# snames are required to complete the translation
translate("AB + cD", snames = "A, B, C, D")
# otherwise snames are not required
translate("PER*FECT + str*ing")
# snames are required
translate("PERFECT + string", snames = "PER, FECT, STR, ING")
# it works even with overlapping columns
# SU overlaps with SUB in SUBER, but the result is still correct
translate("SUBER + subset", "SU, BER, SUB, SET")
# }
# NOT RUN {
# error because combinations of condition names clash
translate("SUPER + subset", "SUP, ER, SU, PER, SUB, SET")
# }
# NOT RUN {
# to print _all_ codes from the standard output matrix
(obj <- translate("A + b*C"))
print(obj, original = TRUE) # also prints the -1 code
# for compute()
data(CVF)
compute("natpride + GEOCON", data = CVF)
# calculating individual paths
compute("natpride + GEOCON", data = CVF, separate = TRUE)
# for findRows()
data(LC)
ttLC <- truthTable(LC, "SURV", show.cases = TRUE)
findRows("DEV*ind*STB", ttLC)
findRows("DEV*ind*STB", ttLC, remainders = TRUE)
# for sop()
sop("(A + B)(A + ~B)") # result is "A"
# to force a certain order of the set names
sop("(URB + LIT*~DEV)(~LIT + ~DEV)", snames = "DEV, URB, LIT")
# multilevel conditions can also be specified (and negated)
sop("(A{1} + ~B{0})(B{1} + C{0})", snames = "A, B, C", noflevels = c(2, 3, 2))
# }
Run the code above in your browser using DataLab