BA NOTES
LOGICAL OPERATORS
1. Logical Not
In R programming 0= false and other numbers= true. Logical not displays the result in the opposite
manner.
2. Element wise logical AND
This takes into consideration for both variables and if any one value of one variable is 0 it displays as
False.
3. Logical And
It takes into consideration of only first value of both the variables.
<- , =, <<- : All these three means equals to
Now TRUE= 1
FALSE= 0
Now if a=2 and var includes 3,4,5,6,7,8,9,10
Then a%in%var will be false as 2 is not included in var
For integer you need to add L
To check its class= class(x)
To find if its integer or not= is.integer(x)
To convert into integer: x=as.integer(54) then output will be 54L
For complex you need to have I
X= 5+4i
For Logical you need to have the ouput as TRUE or FALSE
If x=1 and y=2 and z=x>y which is False then z is Logical
For Character you need to have the output in double quotes
For example “7.8” will be considered as character
26th April extra class: 13:49
29th April extra class: 12:56