Great job! Now, what if we want to compare the result of a calculation with some value? In R, comparisons are performed with the following operators:
- Greater than (
- Greater than or equal to (
- Less than (
- Less than or equal to (
- Equal to (
- Not equal to (
When a comparison is made, R will return either
FALSE, which are called logical values. For example, if we would like to know if John's BMI is less than 30:
87/(1.90*1.90) < 30
R will return one of the following two values:
TRUE if his weight in kilograms divided by his height (in meters squared) is less than 30.
FALSE if his weight in kilograms divided by his height (in meters squared) is not less than 30 (which is equivalent to it being greater than or equal to 30).