Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (9k points)
What are the types of operators in R?

1 Answer

0 votes
by (45.3k points)

R Programming is used to do statistical computing and graphics. To perform the set of operations in terms of statistics, it has a number of operators. The operators in R programming can be widely classified in 4 types and they are:

1. Arithmetic Operator: The arithmetic operators include basic mathematical operations like + for addition, - for subtraction, * for multiplication, / for the division. It also has some other operators like%% to get the remainder of the first term with the second, %/% to get the result of the division of the first term with the second, and ^ to find the result of when the first term is raised to the exponent of the second term.

2. Logical Operator: Logical operators consists of element-wise logical AND operator (&), element-wise logical OR operator (|), and logical NOT operator (!).It also consists of the logical AND operator (&&) and logical OR operator (||). These operators are used when there are conditions that need to checked and executed.

3. Assignment Operator: The assignment operators consist of left assignment (<-, =, <<-) and right assignment (->, ->>) operators. These operators are used to assign values to the R vectors. <- and = operators can be interchanged and used in order to assign value to the variable in the same environment. <<- is used to assign values to variables in the parent environment. It is similar to a global assignment.

4. Miscellaneous Operator: Miscellaneous operators are used for specific tasks rather than the general mathematical and logical computation. It is of 3 types: 

  • : - A colon operator to create a number sequence for a vector
  • %in% - An operator to identify whether an element belongs to the vector 
  • %*% - An operator to multiply a matrix with its own transpose.

If you want to learn more about R and become a professional in this field then you must read R Programming Tutorial.

Also, check out this comprehensive tutorial on R programming:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...