Running 'helpers.R' [0s]
  Running 'test_cluster_compare_vars.R' [162s]
  Running 'test_cluster_pair.R' [169s]
  Running 'test_cluster_pair_blocking.R' [1s]
  Running 'test_cluster_pair_minsim.R' [157s]
  Running 'test_compare_vars.R' [155s]
  Running 'test_distribute_over_cluster.R' [0s]
  Running 'test_greedy.R' [1s]
  Running 'test_merge_pairs.R' [164s]
  Running 'test_pair.R' [168s]
  Running 'test_pair_blocking.R' [1s]
  Running 'test_pair_minsim.R' [1s]
  Running 'test_problink_em.R' [161s]
  Running 'test_score_simple.R' [1s]
  Running 'test_select_greedy.R' [157s]
  Running 'test_select_preprocess.R' [168s]
  Running 'test_select_unique.R' [1s]
  Running 'test_set_seed.R' [167s]
Running the tests in 'tests/test_cluster_compare_vars.R' failed.
Complete output:
  > library(reclin2)
  Loading required package: data.table
  > source("helpers.R")
  > 
  > message("Testing cluster_compare_vars()")
  Testing cluster_compare_vars()
  > 
  > # Passing additional arguments on to the comparison function
  > x <- data.table(foo = 1:3, bar = c("aa", "bb", "cc"))
  > y <- data.table(foo = 3:4, bar = c("cc", "dd"))
  > cl <- parallel::makeCluster(1)
  > pairs <- cluster_pair(cl, x, y)
  > 
  > testfun <- function(x, y, foo = 1) {
  +   rep(foo, length(x))
  + }
  > tmp <- compare_vars(pairs, "foo", comparator = testfun)
  > tmp <- cluster_collect(tmp)
  > expect_equal(tmp$foo, rep(1, 6), attributes = FALSE)
  > 
  > tmp <- compare_vars(pairs, "foo", comparator = testfun, foo = 5)
  > tmp <- cluster_collect(tmp)
  > expect_equal(tmp$foo, rep(5, 6), attributes = FALSE)
  > 
  > message("Testing cluster_compare_vars() successful")
  Testing cluster_compare_vars() successful
  > 
  > parallel::stopCluster(cl)
  > 
  > proc.time()
     user  system elapsed 
     0.35    0.12    0.95 
Running the tests in 'tests/test_cluster_pair.R' failed.
Complete output:
  > 
  > 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)
  + }
  > 
  > expect_equal_pairs <- function(x, y) {
  +   setkey(pairs_ref, .x, .y)
  +   setkey(pairs_loc, .x, .y)
  +   expect_equal(names(x), names(y))
  +   for (col in names(x))
  +     expect_equal(x[[col]], y[[col]])
  + }
  > 
  > library(reclin2)
  Loading required package: data.table
  > 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(cl, x, y)
  > pairs_ref <- pair(x, y)
  > 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(cl, x, deduplication = TRUE)
  > pairs_ref <- pair(x, 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.43    0.09    1.03 
Running the tests in 'tests/test_cluster_pair_minsim.R' failed.
Complete output:
  > 
  > source("helpers.R")
  > 
  > 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
  > 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_minsim(cl, x, y, on = c("a", "b"), minsim = 2)
  > pairs_ref <- pair_minsim(x, y, on = c("a", "b"), minsim = 2)
  > 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_minsim(cl, x, on = c("a", "b"), minsim = 1, deduplication = TRUE)
  > pairs_ref <- pair_minsim(x, on = c("a", "b"), minsim = 1, 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)
  > 
  > 
  > # ===== ON_BLOCKING
  > 
  > 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))
  > 
  > set.seed(103)
  > pairs <- cluster_pair_minsim(cl, x, y, on = "a", on_blocking = "b")
  > pairs_ref <- pair_minsim(x, y, on = "a", on_blocking = "b")
  > pairs_loc <- cluster_collect(pairs)
  > expect_equal_pairs(pairs_ref, pairs_loc)
  > 
  > # Unsing non-existent columns
  > expect_error(cluster_pair_minsim(cl, x, y, on = "a", on_blocking = "foo"))
  > expect_error(cluster_pair_minsim(cl, x, y, on = c("a", "foo"), on_blocking = "b"))
  > 
  > set.seed(103)
  > pairs <- cluster_pair_minsim(cl, x, y, on = "a", on_blocking = "b", minsim = 1)
  > pairs_ref <- pair_minsim(x, y, on = "a", on_blocking = "b", minsim = 1)
  > pairs_loc <- cluster_collect(pairs)
  > expect_equal_pairs(pairs_ref, pairs_loc)
  > 
  > set.seed(103)
  > pairs <- cluster_pair_minsim(cl, x, y, on = "a", on_blocking = "b", minsim = 2)
  > pairs_ref <- pair_minsim(x, y, on = "a", on_blocking = "b", minsim = 2)
  > pairs_loc <- cluster_collect(pairs)
  > expect_equal_pairs(pairs_ref, pairs_loc)
  > 
  > # Missing values
  > x <- data.table(a = c(1,NA,2,2), b = c(1,2,1,2))
  > y <- data.table(a = c(3,3,2,2), b = c(1,2,NA,2))
  > set.seed(103)
  > pairs <- cluster_pair_minsim(cl, x, y, on = "a", on_blocking = "b", minsim = 1)
  > pairs_ref <- pair_minsim(x, y, on = "a", on_blocking = "b", minsim = 1)
  > pairs_loc <- cluster_collect(pairs)
  > expect_equal_pairs(pairs_ref, pairs_loc)
  > 
  > 
  > # ======== FINISH
  > stopCluster(cl)
  > 
  > proc.time()
     user  system elapsed 
     0.70    0.10    1.32 
Running the tests in 'tests/test_compare_vars.R' failed.
Complete output:
  > library(reclin2)
  Loading required package: data.table
  > source("helpers.R")
  > 
  > message("Testing compare_vars()")
  Testing compare_vars()
  > 
  > x <- data.table(foo = 1:3, bar = c("aa", "bb", "cc"))
  > y <- data.table(foo = 3:4, bar = c("cc", "dd"))
  > pairs <- pair(x, y)
  > 
  > tmp <- compare_vars(pairs, "foo")
  > tmp2 <- x$foo[pairs$.x] == y$foo[pairs$.y]
  > stopifnot(is.logical(tmp$foo))
  > stopifnot(isTRUE(all.equal(as.logical(tmp$foo), tmp2)))
  > 
  > tmp <- copy(pairs)
  > compare_vars(tmp, "foo", inplace = TRUE)
  > tmp2 <- x$foo[pairs$.x] == y$foo[pairs$.y]
  > stopifnot(is.logical(tmp$foo))
  > stopifnot(isTRUE(all.equal(as.logical(tmp$foo), tmp2)))
  > 
  > tmp <- compare_vars(pairs, "fooc", "foo")
  > tmp2 <- x$foo[pairs$.x] == y$foo[pairs$.y]
  > stopifnot(is.logical(tmp$fooc))
  > stopifnot(isTRUE(all.equal(as.logical(tmp$fooc), tmp2)))
  > 
  > tmp <- compare_vars(pairs, "fooc", "foo", "foo")
  > tmp2 <- x$foo[pairs$.x] == y$foo[pairs$.y]
  > stopifnot(is.logical(tmp$fooc))
  > stopifnot(isTRUE(all.equal(as.logical(tmp$fooc), tmp2)))
  > 
  > 
  > # Comparing on one variable generates two resulting comparison
  > # vectors
  > testfun <- function(a, b) {
  +   data.table(
  +     jw = cmp_jarowinkler()(a,b),
  +     ja = cmp_jaccard()(a,b)
  +   )
  + }
  > tmp <- compare_vars(pairs, "foo", "bar", "bar", testfun)
  > tmp2 <- 1*(x$bar[pairs$.x] == y$bar[pairs$.y])
  > stopifnot(isTRUE(all.equal(tmp$foo_jw, tmp2)))
  > stopifnot(isTRUE(all.equal(tmp$foo_ja, tmp2)))
  > 
  > 
  > # Multiple variables are compared resulting in one comparison
  > # vector
  > testfun <- function(x, y) {
  +   cmp <- cmp_identical()
  +   c1 <- cmp(x[[1]], y[[1]]) + cmp(x[[2]], y[[2]])
  +   c2 <- cmp(x[[1]], y[[2]]) + cmp(x[[2]], y[[1]])
  +   pmax(c1, c2)
  + }
  > tmp <- compare_vars(pairs, "foo", c("foo", "bar"), comparator = testfun)
  > tmp2 <- (x$foo[pairs$.x] == y$foo[pairs$.y]) + 
  +   (x$bar[pairs$.x] == y$bar[pairs$.y]) 
  > stopifnot(is.numeric(tmp$foo))
  > stopifnot(isTRUE(all.equal(as.numeric(tmp$foo), tmp2)))
  > 
  > # Pairs has zero records
  > x <- data.table(foo = 1:3, bar = c("aa", "bb", "cc"))
  > y <- data.table(foo = 3:4, bar = c("cc", "dd"))
  > y <- y[FALSE,]
  > pairs <- pair(x, y)
  > tmp <- compare_vars(pairs, "foo")
  > tmp2 <- x$foo[pairs$.x] == y$foo[pairs$.y]
  > stopifnot(is.logical(tmp$foo))
  > stopifnot(isTRUE(all.equal(as.logical(tmp$foo), tmp2)))
  > 
  > # Passing additional arguments on to the comparison function
  > x <- data.table(foo = 1:3, bar = c("aa", "bb", "cc"))
  > y <- data.table(foo = 3:4, bar = c("cc", "dd"))
  > pairs <- pair(x, y)
  > 
  > testfun <- function(x, y, foo = 1) {
  +   rep(foo, length(x))
  + }
  > tmp <- compare_vars(pairs, "foo", comparator = testfun)
  > expect_equal(tmp$foo, rep(1, 6), attributes = FALSE)
  > tmp <- compare_vars(pairs, "foo", comparator = testfun, foo = 5)
  > expect_equal(tmp$foo, rep(5, 6), attributes = FALSE)
  > 
  > message("Testing compare_vars() successful")
  Testing compare_vars() successful
  > 
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.37    0.12    0.48 
Running the tests in 'tests/test_merge_pairs.R' failed.
Complete output:
  > 
  > source("helpers.R")
  > 
  > expect_equal_pairs <- function(x, y) {
  +   setkey(x, .x, .y)
  +   setkey(y, .x, .y)
  +   expect_equal(names(x), names(y))
  +   for (col in names(x))
  +     expect_equal(x[[col]], y[[col]], attributes = FALSE)
  + }
  > 
  > library(reclin2)
  Loading required package: data.table
  > library(parallel)
  > 
  > # Prepare data
  > data(linkexample1)
  > data(linkexample2)
  > linkexample1$postcode[1] <- NA
  > linkexample1$postcode[3] <- "6789 XY"
  > 
  > # What the result should look like
  > pairs_ref <- data.table(
  +   .x = c(1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L), 
  +   .y = c(1L, 1L, 2L, 3L, 3L, 4L, 5L, 1L, 2L, 3L, 1L, 2L, 3L, 4L, 5L), 
  +   firstname = c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, 
  +       FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE),
  +   lastname = c(TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, 
  +     FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE)
  + )
  > 
  > # Regular pairs
  > pairs1 <- pair_blocking(linkexample1, linkexample2, on = "postcode")
  > pairs2 <- pair_blocking(linkexample1, linkexample2, on = "lastname")
  > pairs <- merge_pairs(pairs1, pairs2)
  > compare_pairs(pairs, on = c("firstname", "lastname"), inplace = TRUE)
  > expect_equal_pairs(pairs, pairs_ref)
  > 
  > compare_pairs(pairs1, on = c("firstname", "lastname"), inplace = TRUE)
  > compare_pairs(pairs2, on = c("address", "lastname"), inplace = TRUE)
  > pairs <- merge_pairs(pairs1, pairs2)
  > expect_equal(sort(names(pairs)), c(".x", ".y", "address", "firstname", "lastname"))
  > expect_equal(is.na(pairs$address), !is.na(pairs$firstname))
  > 
  > 
  > 
  > # Cluster pairs
  > library(parallel)
  > cl <- makeCluster(2)
  > pairs1c <- cluster_pair_blocking(cl, linkexample1, linkexample2, on = "postcode", name="a")
  > pairs2c <- cluster_pair_blocking(cl, linkexample1, linkexample2, on = "lastname", name="b")
  > pairsc <- merge_pairs(pairs1c, pairs2c)
  > compare_pairs(pairsc, on = c("firstname", "lastname"), inplace = TRUE)
  > pairsc_local <- cluster_collect(pairsc)
  > expect_equal_pairs(pairsc_local, pairs_ref)
  > 
  > compare_pairs(pairs1c, on = c("firstname", "lastname"))
  > compare_pairs(pairs2c, on = c("address", "lastname"))
  > pairsc <- merge_pairs(pairs1c, pairs2c)
  > pairsc_local <- cluster_collect(pairsc)
  > expect_equal(sort(names(pairsc_local)), c(".x", ".y", "address", "firstname", "lastname"))
  > expect_equal(is.na(pairsc_local$address), !is.na(pairsc_local$firstname))
  > 
  > stopCluster(cl)
  > 
  > pairs1 <- pair_blocking(linkexample1, linkexample2, on = "postcode")
  > pairs2 <- pair_blocking(linkexample1, linkexample2, on = "lastname")
  > pairs2 <- pairs2[FALSE, ]
  > pairs <- merge_pairs(pairs1, pairs2)
  > compare_pairs(pairs, on = c("firstname", "lastname"), inplace = TRUE)
  > compare_pairs(pairs1, on = c("firstname", "lastname"), inplace = TRUE)
  > expect_equal_pairs(pairs1, pairs)
  > 
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.53    0.17    1.21 
Running the tests in 'tests/test_pair.R' failed.
Complete output:
  > 
  > 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(x, y)
  > expect_equal(names(pairs), c(".x", ".y"))
  > expect_equal(pairs$.x, rep(1:4, each = 4))
  > expect_equal(pairs$.y, rep(1:4, times = 4))
  > expect_equal(attr(pairs, "x"), x)
  > expect_equal(attr(pairs, "y"), y)
  > 
  > pairs <- pair(x, y, add_xy = FALSE)
  > expect_equal(attr(pairs, "x"), NULL)
  > expect_equal(attr(pairs, "y"), NULL)
  > 
  > 
  > pairs <- pair(x, deduplication = TRUE)
  > expect_equal(names(pairs), c(".x", ".y"))
  > expect_equal(pairs$.x, c(1,1,1,2,2,3))
  > expect_equal(pairs$.y, c(2,3,4,3,4,4))
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.37    0.12    0.46 
Running the tests in 'tests/test_problink_em.R' failed.
Complete output:
  > 
  > 
  > library(reclin2)
  Loading required package: data.table
  > source("helpers.R")
  > 
  > 
  > # ===============================================
  > # Regression test for issue #23
  > # Extreme example where earlier version ended up with m-probabilities equal to 0; 
  > # which resulted in divide by 0 -> NaN -> error. 
  > # This has been fixed. The m-probabilties are now truncated and a warning is issued
  > # as this results in a wrong solution. 
  > 
  > ex1 <- data.frame(
  +     a = "aaaaa",
  +     b = "zzzzz"
  +   )
  > 
  > ex2 <- data.frame(
  +     a = "bbbbb",
  +     b = "zzzzz"
  +   )
  > 
  > pairs <- pair(ex1, ex2)
  > pairs <- compare_pairs(pairs, on = c("a", "b"), default_comparator = cmp_jarowinkler())
  > expect_warning(
  + m <- problink_em(~ a + b, data = pairs)
  + )
  > 
  > proc.time()
     user  system elapsed 
     0.39    0.12    0.45 
Running the tests in 'tests/test_select_greedy.R' failed.
Complete output:
  > library(reclin2)
  Loading required package: data.table
  > source("helpers.R")
  > 
  > pairs <- data.table(
  +   .x = c(3,3,1,2,3,2), 
  +   .y = c(4,5,1,2,1,3),
  +   score = c(1,5,10,5,4,1)
  + )
  > class(pairs) <- c("pairs", class(pairs))
  > 
  > t <- select_greedy(pairs, "select", "score")
  > expect_equal(t$select, c(FALSE, TRUE, TRUE, TRUE, FALSE, FALSE))
  > 
  > t <- select_greedy(pairs, "select", "score", threshold = 20)
  > expect_equal(t$select, c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE))
  > 
  > t <- select_greedy(pairs, "select", "score", threshold = 10)
  > expect_equal(t$select, c(FALSE, FALSE, TRUE, FALSE, FALSE, FALSE))
  > 
  > # Test empty set pairs; regression test
  > t <- select_greedy(pairs[FALSE,], "select", "score", threshold = 10)
  > expect_equal(t$select, logical(0))
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.43    0.10    0.51 
Running the tests in 'tests/test_select_preprocess.R' failed.
Complete output:
  > library(reclin2)
  Loading required package: data.table
  > source("helpers.R")
  > 
  > 
  > data("linkexample1", "linkexample2")
  > linkexample1$id2 <- c(1,1,3,3,5,6)
  > linkexample2$id2 <- c(2,3,3,6,7)
  > 
  > pairs <- pair_blocking(linkexample1, linkexample2, "postcode")
  > pairs[, score := runif(nrow(pairs))]
    First data set:  6 records
    Second data set: 5 records
    Total number of pairs: 17 pairs
    Blocking on: 'postcode'
  
         .x    .y      score
      <int> <int>      <num>
   1:     1     1 0.25339887
   2:     1     2 0.23983090
   3:     1     3 0.13588146
   4:     2     1 0.71307553
   5:     2     2 0.37947169
   6:     2     3 0.04546877
   7:     3     1 0.71910059
   8:     3     2 0.24556343
   9:     3     3 0.94062671
  10:     4     1 0.49430841
  11:     4     2 0.53052170
  12:     4     3 0.49630837
  13:     5     1 0.79928231
  14:     5     2 0.66394101
  15:     5     3 0.49093225
  16:     6     4 0.39278891
  17:     6     5 0.29319413
  > pairs[, select := score > 0.5]
    First data set:  6 records
    Second data set: 5 records
    Total number of pairs: 17 pairs
    Blocking on: 'postcode'
  
         .x    .y      score select
      <int> <int>      <num> <lgcl>
   1:     1     1 0.25339887  FALSE
   2:     1     2 0.23983090  FALSE
   3:     1     3 0.13588146  FALSE
   4:     2     1 0.71307553   TRUE
   5:     2     2 0.37947169  FALSE
   6:     2     3 0.04546877  FALSE
   7:     3     1 0.71910059   TRUE
   8:     3     2 0.24556343  FALSE
   9:     3     3 0.94062671   TRUE
  10:     4     1 0.49430841  FALSE
  11:     4     2 0.53052170   TRUE
  12:     4     3 0.49630837  FALSE
  13:     5     1 0.79928231   TRUE
  14:     5     2 0.66394101   TRUE
  15:     5     3 0.49093225  FALSE
  16:     6     4 0.39278891  FALSE
  17:     6     5 0.29319413  FALSE
  > pairs[, select2 := FALSE]
    First data set:  6 records
    Second data set: 5 records
    Total number of pairs: 17 pairs
    Blocking on: 'postcode'
  
         .x    .y      score select select2
      <int> <int>      <num> <lgcl>  <lgcl>
   1:     1     1 0.25339887  FALSE   FALSE
   2:     1     2 0.23983090  FALSE   FALSE
   3:     1     3 0.13588146  FALSE   FALSE
   4:     2     1 0.71307553   TRUE   FALSE
   5:     2     2 0.37947169  FALSE   FALSE
   6:     2     3 0.04546877  FALSE   FALSE
   7:     3     1 0.71910059   TRUE   FALSE
   8:     3     2 0.24556343  FALSE   FALSE
   9:     3     3 0.94062671   TRUE   FALSE
  10:     4     1 0.49430841  FALSE   FALSE
  11:     4     2 0.53052170   TRUE   FALSE
  12:     4     3 0.49630837  FALSE   FALSE
  13:     5     1 0.79928231   TRUE   FALSE
  14:     5     2 0.66394101   TRUE   FALSE
  15:     5     3 0.49093225  FALSE   FALSE
  16:     6     4 0.39278891  FALSE   FALSE
  17:     6     5 0.29319413  FALSE   FALSE
  > 
  > 
  > # === TESTS FOR ID_X AND ID_Y ARGUMENTS
  > 
  > test <- reclin2:::select_preprocess(pairs, score = "score", id_x = "id", id_y = "id")
  > expect_equal(test$.x, linkexample1$id[pairs$.x])
  > expect_equal(test$.y, linkexample2$id[pairs$.y])
  > 
  > test <- reclin2:::select_preprocess(pairs, score = "score", id_x = "id2", id_y = "id2")
  > expect_equal(test$.x, linkexample1$id2[pairs$.x])
  > expect_equal(test$.y, linkexample2$id2[pairs$.y])
  > 
  > test <- reclin2:::select_preprocess(pairs, score = "score", id_x = "id2", id_y = "id2",
  +   preselect = "select")
  > expect_equal(sort(test$.x), sort(linkexample1$id2[pairs$.x[pairs$select]]))
  > expect_equal(sort(test$.y), sort(linkexample2$id2[pairs$.y[pairs$select]]))
  > 
  > test <- reclin2:::select_preprocess(pairs, score = "score", id_x = "id2", id_y = "id2",
  +   preselect = "select2")
  > expect_equal(nrow(test), 0)
  > expect_equal(names(test), c(".x", ".y", "score", "index"))
  > 
  > expect_error(
  +   test <- reclin2:::select_preprocess(pairs, score = "score", id_x = 1:3, id_y = 1:3,
  +     preselect = "select")
  + )
  > 
  > proc.time()
     user  system elapsed 
     0.43    0.12    0.54 
Running the tests in 'tests/test_set_seed.R' failed.
Complete output:
  > expect_equal <- function(x, y) {
  +   stopifnot(isTRUE(all.equal(x, y)))
  + }
  > 
  > library(reclin2)
  Loading required package: data.table
  > 
  > # distribute_over_cluster sets the seed to ensure that for a given dataset
  > # the records are distributed the same way over a cluster when called 
  > # multiple times. However we don't want to mess up the seed set by the user
  > # so we reset the seed. Below we check if this is done correctly
  > 
  > set.seed(2)
  > d1 <- reclin2:::distribute_over_cluster(100, 4)
  > a1 <- runif(5)
  > d2 <- reclin2:::distribute_over_cluster(100, 4)
  > a2 <- runif(5)
  > 
  > set.seed(2)
  > a1_a2 <- runif(10)
  > 
  > expect_equal(c(a1, a2), a1_a2)
  > expect_equal(d1, d2)
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.37    0.14    0.50