Intermediate R
Q51 / 100

What is the difference between "==" and "identical()" when comparing two R objects?

Correct! Well done.

Incorrect.

The correct answer is B) "==" performs element-wise comparison (and may return NA or a vector), while identical() returns a single TRUE/FALSE checking if the objects are exactly the same in type, attributes, and values

B

Correct Answer

"==" performs element-wise comparison (and may return NA or a vector), while identical() returns a single TRUE/FALSE checking if the objects are exactly the same in type, attributes, and values

Explanation

identical() performs a strict, whole-object comparison returning a single logical, while "==" is vectorized and can yield NA for missing values or vectors of comparisons.

Progress
51/100