How do I test for equality of an object with a scales transformation object?

x <- scales::transform_identity()

if (x == scales::transform_identity()) {
  print("Yes!")
}
#> Error in x == scales::transform_identity(): comparison of these types is not implemented

Created on 2025-01-21 with reprex v2.1.1

Also

x <- scales::transform_identity()

identical(x, scales::transform_identity())
#> [1] FALSE

Created on 2025-01-21 with reprex v2.1.1

> setequal(x, scales::transform_identity())
[1] TRUE
1 Like