Many arithmetic operators are used in R. Remember, R uses the operators component by component. Let’s look at it with some standard operators.
>x <- c(1,2,3,4) > y <- c(4,5,6,7) > x+y [1] 5 7 9 11 > x-y [1] -3 -3 -3 -3 > z <- (4,4,4,4,4,4,4) > x+z [1] 5 6 7 8 5 6 7 When we have two vectors with unequal lengths, and we need to operate on both, then the shorter vector is used again and again to match the length of both the vectors.