'OR expression in R

I have become incredibly confused over logical expressions in R. The following command gives me the expected result since 1 is equal to 1 or equal to 2:

> 1 == (1 | 2)
[1] TRUE

But on the other hand I get:

3 == (3 | 4)
[1] FALSE

If anybody could give some insight into what is happening here I would be very grateful!



Solution 1:[1]

I think this will answer your question

1 == T

[1] TRUE

2==T

[1] FALSE

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1