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))) + } > > library(reclin2) Loading required package: data.table Attaching package: 'reclin2' The following object is masked from 'package:base': identical > > 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.31 0.07 0.37