Section 8 R Object Assignment
8.1 R Object Assignment
| Operator | Explanation | Example |
|---|---|---|
| + | Addition | x + y |
| - | Subtraction | x - y |
| * | Multiplication | x * y |
| / | Division | x / y |
| %% | Modulus | x %% y |
| %/% | Integer division | x %/% y |
| ^ | Exponentiation | x ^ y |
| () | Parenthesis (precedence rule) | (x + y) * z |
| - | Negate | -x |
8.2 R Object Example
x <- 10
print(x) # explicit printing
x # auto-printing
x + 3
x / 3
-x
y <- x + 3
y
x + y
x - y
x * y
x / y8.3 More Examples
x <- 10
y <- x + 3
y^2
y %/% x
y %% x
z <- 2
5*x + 3*y + 7*z
5*x^2 + 3*x*y + 7*z^3 + 8*sqrt(y)
x; y; z
x %/% z / y * x