Skip to content

Commit a10a743

Browse files
committed
fix(approx_equal): consistency with vec_slice(na_equal=FALSE)
1 parent 980e9b7 commit a10a743

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

R/patch.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ approx_equal0 <- function(vec1, vec2, abs_tol, na_equal, inds1 = NULL, inds2 = N
4444
res <- fifelse(
4545
!is.na(vec1) & !is.na(vec2),
4646
abs(vec1 - vec2) <= abs_tol,
47-
if (na_equal) is.na(vec1) & is.na(vec2) else FALSE
47+
if (na_equal) is.na(vec1) & is.na(vec2) else NA
4848
# XXX ^ inconsistent with vec_equal treatment: NA vs. NaN comparison
49-
# behavior with na_equal = TRUE is different; plus output with na_equal =
50-
# FALSE on two NAs is different
49+
# behavior with na_equal = TRUE is different
5150
)
5251
# `fifelse` inherits any unrecognized attributes; drop them instead:
5352
attributes(res) <- NULL

0 commit comments

Comments
 (0)