Page 216 - Data Science class 11
P. 216
5. %% Modulus (Remainder from division) operator gives the remainder of the first vector with the second
Example
Enter the following code snippet:
first <- c( 3,7.5,12)
second <- c(7, 7.5, 5)
print(first%%second)
print(second%%second)
print(second%%first)
print(First%%second)
The following result is produced:
You will observe that in the last print order, the programmer made a mistake in typing the variable name as "First"
instead of "first". So we got the error message.
b. Relational Operators
The R language supports the following operators. Each element of the first vector is compared with the corresponding
element of the second vector. The result of the comparison is a Boolean value.
1. > The Greater than operator checks to see if each element of the first vector is greater than the corresponding
element of the second vector.
Example
Enter the following code snippet:
first <- c( 3,7.5,12)
second <- c(7, 7.5, 5)
print(first>second)
print(second>first)
The following result is produced:
214 Touchpad Data Science-XI

