Operators in R | R Programming

sanket-parate Trending Technology

This is the fifth part of the R series. In this article will know about Operators in R Programming.The operators are those symbols which tell the compiler to perform mathematical manipulations.

There are mainly five types of operators, which are as follows:

1. Arithmetic Operators
2. Assignment Operators
3. Relational Operators
4. Logical Operators
5. Special Operators

Arithmetic Operators: These operators are used to perform arithmetic operations such as addition, subtraction, multiplication, division etc.
Syntax: Variable name <- value
Examples are:

# Addition
X <- 20
Y<- 10
X + Y

Output:

# Subtraction
X-Y

Output:

# Multiplication
X*Y

Output:

# Division
X/Y

Output:

Assignment Operators: These operators are used to assign values.
Examples are:

# Leftwards Assignment
X<-50
X

Output:

# Rightwards Assignment
10 -> X

Output:

3. Relational Operator: These Operators defines a relation between two entities.

X<-5
X!=3

Output:

4.Logical Operator: These Operators compare two entities and typically used with Boolean (logical) values.

X <-9
9&6

Output:

5. Special Operators: These operators are used for specific purpose.

X <-5:10

Output:


Sanket Parate

Tech enthusiast and an optimistic guy with the mindset to achieve the set target. I am an avid learner and passionate learner. After finding my interest in data science, I felt that 'Yes this is the field which I am looking for. I am more passionate to learn data science and R and looking forward to exploring more in these fields along with the python. I love to share information with people.

3 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *