R Under development (unstable) (2024-02-08 r85876 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > expect_equal <- function(x, y) { + stopifnot(isTRUE(all.equal(x, y))) + } > > library(reclin2) Loading required package: data.table > > x <- data.table(a = c(1,1,2,2), b = c(1,2,1,2)) > y <- data.table(a = c(3,3,2,2), b = c(1,2,1,2)) > > pairs <- pair_blocking(x, y, on = "a") > expect_equal(names(pairs), c(".x", ".y")) > expect_equal(pairs$.x, c(3,3,4,4)) > expect_equal(pairs$.y, c(3,4,3,4)) > expect_equal(attr(pairs, "x"), x) > expect_equal(attr(pairs, "y"), y) > > pairs <- pair_blocking(x, y, on = "a", add_xy = FALSE) > expect_equal(attr(pairs, "x"), NULL) > expect_equal(attr(pairs, "y"), NULL) > > pairs <- pair_blocking(x, on = "a", deduplication = TRUE) > expect_equal(names(pairs), c(".x", ".y")) > expect_equal(pairs$.x, c(1,3)) > expect_equal(pairs$.y, c(2,4)) > > > proc.time() user system elapsed 0.51 0.09 0.57