Consider vec_proxy_compare method for era_yr
joeroe opened this issue · comments
Currently:
library("era")
a <- yr(1:10, "BP")
b <- yr(1:10, "BP")
c <- yr(1:10, "BC")
a == b
#> [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
a == c
#> Error: Can't combine `..1` <yr (BP)> and `..2` <yr (BC)>.
#> Reconcile eras with yr_transform() first.
The first result is correct. The second result maybe too strict and should return FALSE
instead of an error.
On second thoughts, an error is appropriate here – transformations between eras should always be explicit. Following 5be5823, the comparison is flexible enough, e.g.:
yr(1:3, "BP") == yr(1:3, "cal BP")
#> [1] TRUE TRUE TRUE
And users can always fall back on e.g.:
yr(1:3, "BP") == yr_transform(yr(1:3, "BC"), "BP")
#> [1] FALSE FALSE FALSE