At Google, testthat::expect_identical() should be the default/go-to function for
comparing an output to an expected value. expect_true(identical(x, y))
is an equivalent but unadvised method of the same test. Further,
testthat::expect_equal() should only be used when expect_identical()
is inappropriate, i.e., when x and y need only be numerically
equivalent instead of fully identical (in which case, provide the
tolerance= argument to expect_equal() explicitly). This also applies
when it's inconvenient to check full equality (e.g., names can be ignored,
in which case ignore_attr = "names" should be supplied to
expect_equal() (or, for 2nd edition, check.attributes = FALSE).
expect_identical_linter()
The linter allows expect_equal() in three circumstances:
A named argument is set (e.g. ignore_attr or tolerance)
Comparison is made to an explicit decimal, e.g.
expect_equal(x, 1.0) (implicitly setting tolerance)
... is passed (wrapper functions whcih might set
arguments such as ignore_attr or tolerance)
package_development
linters for a complete list of linters available in lintr.