Write R code to create two variables, a and b, with numeric values 4 and 6. Then print the result of their sum.
R allows you to perform arithmetic, comparison, and logical operations.
+ : addition- : subtraction* : multiplication/ : division^ : exponentiation%% : modulus (remainder)%/% : integer divisiona <- 10
b <- 3
a + b
a - b
a * b
a / b
a ^ b
a %% b
a %/% b
== : equal to!= : not equal to< : less than> : greater than<= : less than or equal to>= : greater than or equal tox <- 5
y <- 7
x == y
x != y
x < y
x >= y
& : AND| : OR! : NOTTRUE & 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