0

I can't find the answer and the simple approaches I've tried haven't worked. Basically, I have two corresponding dataframes with identical dimensions, full of boolean values.

I want "OR" logic, to produce a third corresponding dataframe with a TRUE anywhere either starting dataframes had TRUE.

df1 <- data.frame(a=c(T,T),
                  b=c(F,F))
df2 <- data.frame(a=c(F,T),
                  b=c(F,T))

Desired output:

        a     b
[1,] TRUE FALSE
[2,] TRUE  TRUE
divibisan
  • 8,631
  • 11
  • 31
  • 46
user26481
  • 53
  • 7
  • For the future, please include reproducible examples of your data and your desired output. I've added it here since it was a simple example, but usually questions with out a [mcve] will get downvoted and closed – divibisan Mar 04 '19 at 18:34
  • As simple as `df1 | df2`. – Rui Barradas Mar 04 '19 at 18:46

1 Answers1

3

It works using the | operator:

df1 | df2

        a     b
[1,] TRUE FALSE
[2,] TRUE  TRUE
divibisan
  • 8,631
  • 11
  • 31
  • 46
user26481
  • 53
  • 7