R Under development (unstable) (2023-07-19 r84711 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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))) + } > > expect_equal_pairs <- function(x, y) { + setkey(pairs_ref, .x, .y) + setkey(pairs_loc, .x, .y) + expect_equal(pairs_ref$.x, pairs_loc$.x) + expect_equal(pairs_ref$.y, pairs_loc$.y) + } > > library(reclin2) Loading required package: data.table Attaching package: 'reclin2' The following object is masked from 'package:base': identical > library(parallel) > > 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)) > > > cl <- makeCluster(2) > > set.seed(103) > pairs <- cluster_pair_blocking(cl, x, y, on = "a") > pairs_ref <- pair_blocking(x, y, on = "a") > pairs_loc <- cluster_collect(pairs) > pairs_ref <- compare_pairs(pairs_ref, c("a", "b")) > pairs_loc <- compare_pairs(pairs_loc, c("a", "b")) > expect_equal_pairs(pairs_ref, pairs_loc) > # The compare_pairs was added to fix a bug where the x after > # cluster_colled was not longer in the correct order; issue #2 > > set.seed(103) > pairs <- cluster_pair_blocking(cl, x, on = "a", deduplication = TRUE) > pairs_ref <- pair_blocking(x, on = "a", deduplication = TRUE) > pairs_loc <- cluster_collect(pairs) > pairs_ref <- compare_pairs(pairs_ref, c("a", "b")) > pairs_loc <- compare_pairs(pairs_loc, c("a", "b")) > expect_equal_pairs(pairs_ref, pairs_loc) > > stopCluster(cl) > > > proc.time() user system elapsed 0.25 0.14 0.78