Skip to content
Prev 390983 / 398506 Next

Is there a Truth Table Generator in R?

As Tim pointed out, your query is rather vague. A reprex would have
really helped here: please include them whenever possible in future
queries.

As Spencer said, a simple search would likely have yielded whatever
you were seeking. Do make such efforts before posting.

And as Jeff indicated, it's most likely straightforward to create a
function that does what you want de novo. Here is such a function
based on my guess of what you meant:

tt <- function(tabl, fun)
 {## fun is a function that when applied rowwise to
 ## the logical data frame tabl yields a
 ## logical result
 cbind(tabl, Result = apply(tabl,1,fun))
 }

## some examples
Var1  Var2 Result
1  TRUE  TRUE   TRUE
2 FALSE  TRUE   TRUE
3  TRUE FALSE   TRUE
4 FALSE FALSE  FALSE
Var1  Var2 Result
1  TRUE  TRUE   TRUE
2 FALSE  TRUE  FALSE
3  TRUE FALSE  FALSE
4 FALSE FALSE  FALSE
Var1  Var2 Result
1  TRUE  TRUE   TRUE
2 FALSE  TRUE   TRUE
3  TRUE FALSE  FALSE
4 FALSE FALSE   TRUE

Cheers,
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Sat, Mar 12, 2022 at 9:13 AM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote: