1111# ' be consistent with `vec_slice`-ing to these indices beforehand, but can
1212# ' give faster computation if `vec1` and `vec2` are data frames.
1313# '
14- # ' @return logical vector; no nonmissing entries if `na_equal = TRUE`. Behavior
15- # ' may differ from `vec_equal` with non-`NA` `NaN`s involved, or for bare
16- # ' lists that contain named vectors.
14+ # ' @return logical vector, with length matching the result of recycling `vec1`
15+ # ' (at `inds1` if provided) and `vec2` (at `inds2` if provided); entries
16+ # ' should all be `TRUE` or `FALSE` if `na_equal = TRUE`. Behavior may differ
17+ # ' from `vec_equal` with non-`NA` `NaN`s involved, or for bare lists that
18+ # ' contain named vectors.
1719approx_equal <- function (vec1 , vec2 , abs_tol , na_equal , .ptype = NULL , inds1 = NULL , inds2 = NULL ) {
1820 # Recycle inds if provided; vecs if not:
1921 common_size <- vec_size_common(
@@ -34,6 +36,9 @@ approx_equal <- function(vec1, vec2, abs_tol, na_equal, .ptype = NULL, inds1 = N
3436 approx_equal0(vecs [[1 ]], vecs [[2 ]], abs_tol , na_equal , inds1 , inds2 )
3537}
3638
39+ # ' Helper for [`approx_equal`] for vecs guaranteed to have the same ptype and size
40+ # '
41+ # ' @keywords internal
3742approx_equal0 <- function (vec1 , vec2 , abs_tol , na_equal , inds1 = NULL , inds2 = NULL ) {
3843 if (is_bare_numeric(vec1 ) && abs_tol != 0 ) {
3944 # perf: since we're working with bare numerics and logicals: we can use `[`
0 commit comments