Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Feb 12, 2024
1 parent 2321e6d commit 518edd3
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions R/jaccard_join_core.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,25 @@ jaccard_join <- function (a, b, mode, by, salt_by, n_gram_width, n_bands,
return(matches)
}

browser()
not_matched_a <- collapse::`%!iin%`(seq(nrow(a)), match_table[,1])
not_matched_b <- collapse::`%!iin%`(seq(nrow(b)), match_table[,2])

if (mode == "left") {
matches <- dplyr::bind_rows(matches,a[not_matched_a,])
} else if (mode == "right") {
matches <- dplyr::bind_rows(matches,b[not_matched_b,])
} else if (mode == "full") {
matches <- dplyr::bind_rows(matches,a[not_matched_a,],b[not_matched_b,])
} else if (mode == "anti") {
matches <- dplyr::bind_rows(a[not_matched_a,], b[not_matched_b,])
} else {
stop("Invalid Mode Selected!")
}

return(matches)
switch(
mode,
"left" = {
not_matched_a <- ! seq(nrow(a)) %in% match_table[,1]
matches <- dplyr::bind_rows(matches, a[not_matched_a,])
},
"right" = {
not_matched_b <- ! seq(nrow(b)) %in% match_table[,2]
matches <- dplyr::bind_rows(matches, b[not_matched_b,])
},
"full" = {
not_matched_a <- ! seq(nrow(a)) %in% match_table[,1]
not_matched_b <- ! seq(nrow(b)) %in% match_table[,2]
matches <- dplyr::bind_rows(matches, a[not_matched_a,], b[not_matched_b,])
},
"anti" = {
not_matched_a <- ! seq(nrow(a)) %in% match_table[,1]
not_matched_b <- ! seq(nrow(b)) %in% match_table[,2]
matches <- dplyr::bind_rows(a[not_matched_a,], b[not_matched_b,])
}
)
}

0 comments on commit 518edd3

Please sign in to comment.