The OR operator in R is used to perform logical OR operations on two or more conditions. It returns TRUE if at least one of the conditions is true, otherwise, it returns FALSE. In R, the OR operator is represented by |.
Example:
x <- 5
y <- 10
if (x > 0 | y > 20) {
print("At least one condition is true")
} else {
print("Both conditions are false")
}
Output:
[1] "At least one condition is true"