Quantcast
Channel: Logical Operation in R - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Logical Operation in R

$
0
0

I have three columns named i1,i2 and i3. Each of these columns is a vector of equal length. Each of them contain 1 and -1. I want to have an output column where the value should be

  • 1 if all the entires in i1,i2 and i3 is 1
  • -1 if all the entries in i1,i2 and i3 is -1
  • 0 for any other valuesPlease suggest the way forward.

three columns of a data frame


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images