Next →

Output:


      

Plots:

Basic Operators and Expressions in R

R allows you to perform arithmetic, comparison, and logical operations.

Arithmetic Operators

a <- 10
b <- 3

a + b
a - b
a * b
a / b
a ^ b
a %% b
a %/% b

Comparison Operators

x <- 5
y <- 7

x == y
x != y
x < y
x >= y

Logical Operators

TRUE & FALSE
TRUE | FALSE
!TRUE

Operators can be combined to create more complex expressions:

x <- 10
y <- 20
z <- 15

x < y & z > x
x == 10 | y == 15