R Operators

R Operators

Operators are highly specialized symbols used to perform operations on variables and values.

R divides its immense collection of operators into several logical groups.


Arithmetic Operators

These operators confidently perform standard mathematical calculations.


Comparison Operators

These operators compare two values and strictly return a boolean TRUE or FALSE.


Logical Operators

Logical operators combine multiple conditional boolean statements together securely.

Logical Operators Example:

x <- 10
# Returns TRUE because both conditions are completely true!
print(x > 5 & x < 15)
# Returns TRUE because at least one condition is true!
print(x == 10 | x == 100)

Exercise 1 of 2

?

Which comparison operator is used to verify if two values are exactly equal?

Exercise 2 of 2

?

Which logical operator returns TRUE only if BOTH conditional statements evaluate to TRUE?