0% found this document useful (0 votes)
53 views

Basic Arithmetic Operations

R can perform basic arithmetic operations like addition, subtraction, multiplication, division, and exponentiation using operators like +, -, *, /, and ^. The document provides examples of commands to calculate these operations in R such as 3 + 7 to add numbers, 7 - 3 to subtract them, and 2^3 to calculate exponents, illustrating how R can function as a basic calculator.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Basic Arithmetic Operations

R can perform basic arithmetic operations like addition, subtraction, multiplication, division, and exponentiation using operators like +, -, *, /, and ^. The document provides examples of commands to calculate these operations in R such as 3 + 7 to add numbers, 7 - 3 to subtract them, and 2^3 to calculate exponents, illustrating how R can function as a basic calculator.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 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.

You might also like