Вы находитесь на странице: 1из 1

Basic arithmetic operations

R can be used as a calculator.

The basic arithmetic operators are:

+ (addition)
- (subtraction)
* (multiplication)
/ (division)
and ^ (exponentiation).

Type directly the command below in the console:

# Addition
3 + 7

[1] 10

# Substraction
7 - 3

[1] 4

# Multiplication
3 * 7

[1] 21

# Divison
7/3

[1] 2.333333

# Exponentiation
2^3

[1] 8

# Modulo: returns the remainder of the division of 8/3


8 %% 3

[1] 2

Note that, in R, �#� is used for adding comments to explain what the R code is
about.

Вам также может понравиться