Recall & Review
beginner
What does the
== operator do in R?The
== operator checks if two values are equal and returns TRUE if they are, otherwise FALSE.Click to reveal answer
beginner
How do you check if one value is greater than another in R?
Use the
> operator to check if the left value is greater than the right value. It returns TRUE or FALSE.Click to reveal answer
beginner
What is the difference between
== and != in R?== checks if two values are equal, while != checks if two values are NOT equal.Click to reveal answer
beginner
What do the operators
<= and >= mean in R?<= means 'less than or equal to' and >= means 'greater than or equal to'. They compare two values and return TRUE or FALSE.Click to reveal answer
intermediate
How does R handle comparison of vectors with comparison operators?
R compares vectors element by element and returns a logical vector of
TRUE or FALSE for each comparison.Click to reveal answer
What will
5 == 5 return in R?✗ Incorrect
== checks equality and returns TRUE if values are equal.Which operator checks if two values are NOT equal in R?
✗ Incorrect
!= means 'not equal to' and returns TRUE if values differ.What does
3 >= 4 return?✗ Incorrect
3 >= 4 means '3 greater than or equal to 4', which is false.How does R compare vectors with
< operator?✗ Incorrect
R compares each element of vectors and returns a logical vector.
What is the result of
c(1,2,3) == 2 in R?✗ Incorrect
Only the second element equals 2, so result is
FALSE TRUE FALSE.Explain how comparison operators work in R and give examples of at least three different operators.
Think about how you check if two things are equal or one is bigger than the other.
You got /4 concepts.
Describe how R handles comparison when using vectors instead of single values.
Imagine comparing two lists of numbers one by one.
You got /3 concepts.