# 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}", snames = "A, B, C", 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")
# to print _all_ codes from the standard output matrix
(obj <- translate("A + b*C"))
print(obj, original = TRUE) # also prints the -1 code
# }
Run the code above in your browser using DataLab