Skip to content

Instantly share code, notes, and snippets.

@arademaker
Created March 3, 2011 02:15
Show Gist options
  • Save arademaker/852194 to your computer and use it in GitHub Desktop.
Save arademaker/852194 to your computer and use it in GitHub Desktop.
constructing truth tables in R
library(gtools)
data <- permutations(2, 3, v = c(T,F), repeats.allowed=TRUE)
tt <- as.data.frame(data)
names(tt) <- letters[1:3]
tt$"! (a | b) | c" <- (!(tt$a | tt$b) | tt$c)
# unusual output!
xtable(tt)
print(xtable(sapply(tt, as.character)), include.rownames=F)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment