Skip to content

Commit

Permalink
simplify %==% logic to use vec_equal()
Browse files Browse the repository at this point in the history
  • Loading branch information
khusmann committed Oct 12, 2024
1 parent 5253194 commit 2ab68b9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions R/interlaced.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,8 @@ new_interlaced <- function(value_channel, na_channel, ...) {

#' @export
`%==%.default` <- function(x, y) {
m_x <- na_channel(x)
m_y <- na_channel(y)
if_else(
!is.na(x) & !is.na(y),
value_channel(x) == value_channel(y),
is.na(x) & is.na(y) & (
(!is.na(m_x) & !is.na(m_y) & m_x == m_y) | (is.na(m_x) & is.na(m_y))
),
)
args <- vec_cast_common(x, y)
vec_equal(vec_proxy(args[[1]]), vec_proxy(args[[2]]), na_equal = TRUE)
}

#' @rdname grapes-equals-grapes
Expand Down

0 comments on commit 2ab68b9

Please sign in to comment.