ยง2024-12-04

R Booleans (Comparison and Logical Operators)

## Online R compiler to run R program online
## Print "Try programiz.pro" message
# declare boolean 
x <- TRUE
print(x)
print(class(x))
# declare boolean using single character
y <- F
print(y)
print(class(y))

x <- 10
y <- 23
# compare x and y
print(x == y)  # FALSE


TRUE & TRUE
TRUE & FALSE
FALSE & TRUE
FALSE & FALSE

# print | of TRUE and FALSE combinations
TRUE | TRUE
TRUE | FALSE
FALSE | TRUE
FALSE | FALSE

w <- 54
x <- 12
y <- 25
z <- 1

print(w>x | x>y | z>w)