R Tutorial – We shall learn about R Operators – Arithmetic, Relational, Logical, Assignment and some of the Miscellaneous Operators that R programming language provides.
RoboForex Stocks - free stock charts and real-time market data. Excellent trading conditions: 10000+ stocks and ETFs. There are four main categories of Operators in R programming language.
R Operators
There are four main categories of Operators in R programming language. They are shown in the following picture :
We shall learn about these operators in detail with Example R programs.
R Arithmetic Operators
Arithmetic Operators are used to accomplish arithmetic operations. They can be operated on the basic data types Numericals, Integers, Complex Numbers. Vectors with these basic data types can also participate in arithmetic operations, during which the operation is performed on one to one element basis.
An example for each of the arithmetic operator on Numerical values is provided below.
r_op_arithmetic.R
Output
An example for each of the arithmetic operator on Vectors is provided below.
r_op_arithmetic_vector.R
Output
R Relational Operators
Relational Operators are those that find out relation between the two operands provided to them. Following are the six relational operations R programming language supports.The output is boolean (TRUE or FALSE) for all of the Relational Operators in R programming language.
An example for each of the relational operator on Numberical values is provided below.
r_op_relational.R
Output
An example for each of the relational operator on Vectors is provided below.
r_op_relational_vector.R
Output
R Logical Operators
Logical Operators in R programming language work only for the basic data types logical, numeric and complex and vectors of these basic data types.
An example for each of the logical operators on Numerical values is provided below.
r_op_logical.R
Output
An example for each of the logical operators on Vectors is provided below.
Output
R Relational Operators
Relational Operators are those that find out relation between the two operands provided to them. Following are the six relational operations R programming language supports.The output is boolean (TRUE or FALSE) for all of the Relational Operators in R programming language.
An example for each of the relational operator on Numberical values is provided below.
r_op_relational.R
Output
An example for each of the relational operator on Vectors is provided below.
r_op_relational_vector.R
Output
R Logical Operators
Logical Operators in R programming language work only for the basic data types logical, numeric and complex and vectors of these basic data types.
An example for each of the logical operators on Numerical values is provided below.
r_op_logical.R
Output
An example for each of the logical operators on Vectors is provided below.
r_op_logical_vector.R
Output
R Assignment Operators
If In Racket
Assignment Operators are those that help in assigning a value to the variable.
An example for each of the assignment operators is provided below.
r_op_assignment.R
Output
R Miscellaneous Operators
How to see private ip address. These operators does not fall into any of the categories mentioned above, but are significantly important during R programming for manipulating data.
An example for each of the Miscellaneous operators is provided below.
r_op_misc.R
If In Response To A Decrease In The Price Of Coffee
Output
R If Else With Dates
Conclusion
In this R Tutorial, we have learnt about R Operators – R Arithmetic Operators, R Relational Operators, R Logical Operators, R Assignment Operators, R Miscellaneous Operators with example R commands and R script files.