Performing AND , OR , operations in R


Performing AND , OR , operations in R

An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.R language is rich in built in operators.

The logical operators supported by R language is applicable only to vectors of type logical , numeric or complex . All numbers greater than 1 are considered as logical value TRUE.

Each element of the first vector is compared with the corresponding element of the record vector.

The result of comparison is a Boolean value.

‘&’ à It is called element wise logical – OR operator , it compares both elements , it gives output TRUE if both elements are TRUE.
‘|’ àIt is called element wise LOGICAL OR operator ,it combines each element of the first  vactor with the corresponding element of the second vector and gives an output TRUE if one element is TRUE.
‘ !’ àit is Logical NOT operator , takes each element and gives opposite logical value.

Comments