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: 5

No comments:

All Rights Reserved by Technology from Developers Eye © 2014 - 2015
Powered By Blogger, Designed by Aadics
Disclaimers:: The information provided within this blogsite is for general informational purposes only. While we try to keep the information up-to-date and correct, there are no representations or warranties, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information, products, services, or related graphics contained in this blogsite for any purpose.The author does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause.

Contact Form

Name

Email *

Message *

Powered by Blogger.