Arithmetic operators

a <- c(20, 40, 60)
b <- c(100, 3, 5)

Note all operators occur on each of corresponding elements

a+b
## [1] 120  43  65
b-a
## [1]  80 -37 -55
a/b
## [1]  0.20000 13.33333 12.00000
a*b
## [1] 2000  120  300

For exponential

b**a
## [1] 1.000000e+40 1.215767e+19 8.673617e+41
b^a
## [1] 1.000000e+40 1.215767e+19 8.673617e+41
#Both give the same result

Integer division

a%%b #returns the modulus, so a/b but keeps the remainder
## [1] 20  1  0
a %/% b #returns the modulus, but keeps the integer
## [1]  0 13 12

Logical operators

a < b
## [1]  TRUE FALSE FALSE
a <= b
## [1]  TRUE FALSE FALSE
a > b
## [1] FALSE  TRUE  TRUE
a >= b
## [1] FALSE  TRUE  TRUE
a == b #Don't use the single = sign, as it will instead assign a to equal b
## [1] FALSE FALSE FALSE

Special operators

a <- seq(0,10,2)
b <- seq(0,10,3)
a
## [1]  0  2  4  6  8 10
b
## [1] 0 3 6 9
b %in% a #This checks each element of b and seeing if it is in a (without considering matching elements)
## [1]  TRUE FALSE  TRUE FALSE