tests/testthat/test-headtail.R

test_that("headtail returns the first and last rows", {
  out <- headtail(iris, n = 2)

  expect_s3_class(out, "basetable")
  expect_equal(nrow(out), 4L)
  expect_equal(out$Sepal.Length[[1]], iris$Sepal.Length[[1]])
  expect_equal(out$Sepal.Length[[4]], iris$Sepal.Length[[150]])
})

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.