Take Notes
Add notes here about the concepts you've learned and code cells with code you want to keep.
Relational Operators
A relational Operator's primary job is to compare objects of R. How one piece of data relates to another connecting bridges between different series of script to better comprehend data.It can be applied to all variables - LOGICAL, CHARACTER and NUMERIC. It always returns a LOGIC answeto its command ie. TRUE or FALSE.
Context of relators used to make comparisons in R programs are as follows:
-
Equality - == eg. "Pizza" == "Pasta" - FALSE, 3 == 1 * 3 - TRUE, TRUE == TRUE - TRUE.
-
Inequality - != eg. "Pizza" != "Pasta" - TRUE, 3 != 1 * 3 - FALSE, TRUE != TRUE - FALSE.
-
Greater or Less than <> eg. 23 < 26 - TRUE, 11 > 15 - FALSE. Applies to CHARACTERS aswell but ordered according to the Alphabetic order for example "chocolate" > "Sweets" is FALSE as C comes before S in the alphabet. As for LOGICS TRUE and FALSE, TRUE represents 1 and FALSE 0 meaning "TRUE" > "FALSE" is TRUE.
-
Greater than or equal to, Less than or equal to >= <= All of the above expressions corrospond to these relators in the same manner.
Applying Relators to relevant Vectors:
Utiltising relators are highly manageable when working with vectors containing strings of data because you can quickly retrieve a segment of information in a simplistic format. In addition to finding singular values from a string of data you can also compare vectors as a whole.
Vectors Comparison:
Manchester united and Arsenal goals attributed per month in all competitions:
Manu <- c(8, 4, 6, 11, 4, 9, 13)
Manu > 5
Arsenal <- c(6, 9, 15, 5, 8, 12, 10)
Arsenal <=10
Arsenal >= ManuAdd your notes here
# Add your code snippets here