tests/testthat/test-merge.R

test_that("merge joins two tables", {
  x <- data.frame(id = c(1, 2), value_x = c("a", "b"))
  y <- data.frame(id = c(1, 3), value_y = c("c", "d"))

  out <- merge(x, y, by = "id", all.x = TRUE)

  expect_s3_class(out, "basetable")
  expect_equal(nrow(out), 2L)
  expect_true(all(c("id", "value_x", "value_y") %in% names(out)))
})

Try the basetable package in your browser

Any scripts or data that you put into this service are public.

basetable documentation built on Sept. 18, 2026, 9:13 a.m.