Operators in R
R
supports many operators for it’s operation with data and entity which could be mathematical,
logical, or relational equality, non equality and some special operators to
perform in an expression.
Additive
Operators
X+Y–
addition. –Adding two vectors
X–Y
- subtraction-Subtracting two vectors
Multiplicative
Operators
X*Y–
Multiplication.-Multiplying first vector element corresponding to the second
vector element
Division
Operators
X/Y
Division. Dividing first vector element
corresponding to the second vector element
Remainder
Operators
%%--The
remainder evaluates first vector with to
the corresponding element of the second vector
Division
Operators
%/%--
Division of first vector with the second vectors
Exponential
Operators
X ^2--
The first vector raised to the exponent of second vector
Relational
Operators
X<Y –Evaluates
each element of the first vector is greater than the corresponding element of
the second vector and result would be Boolean values
X>Y –Evaluates
each element of the first vector is lesser than the corresponding element of
the second vector and result would be Boolean values
X<=Y –Evaluates
each element of the first vector is greater than or equal to the corresponding
element of the second vector and result would be Boolean values
X>Y –Evaluates
each element of the first vector is less than or equal to the corresponding
element of the second vector and result would be Boolean values
Equality
Operators
X==Y-
Equality. Evaluations happens to ascertain both the values are equal
X!=Y
- not equal. Evaluations happens to ascertain both the values are equal
Element
AND Operator
X&Y-It
joins each element of the first vector with the corresponding element of the
second vector and result would be Boolean values .i.g TRUE if both the elements are TRUE
Element
OR Operator
X|Y-It
joins each element of the first vector with the corresponding element of the
second vector and result would be Boolean values .i.g TRUE if one the elements is TRUE
Element
NOT Operator
!X-It
reverses the present value in vector e.g
“TRUE to False” or “False to True”
Conditional
AND Operator
X&&Y-
logical AND. If the first operand is
false, it not evaluate the second operand.
Conditional
OR Operator
X||Y
– logical OR. If the first operand is true, it does not evaluate the second
operand.
Assignment
Operator
Left
associated operator :: <− or = or <<−
Right
associated operator :: −> or −>>
Special
Operators
These operators have different aspects to take
care in our daily programming work.
: == Range operator
%in% == search in collection
%*% == Matrix manipulation operator
Operators in R
Reviewed by Rupesh
on
07:37
Rating:
No comments: