tests/testthat/test-Merge-Cells.R

test_that("Merging cells", {
  library(tablespan)
  # We should only merge cells where all left hand side elements are also equal
  row_data <- data.frame(cyl = c(4,4,6,6,8),
                         vs  = c(1,1,1,0,0))
  ids <- tablespan:::row_data_cell_ids(row_data)
  testthat::expect_true(all(ids == matrix(c(1,1,
                                            1,1,
                                            2,2,
                                            2,3,
                                            3,4),
                                          nrow = 5,
                                          ncol = 2,
                                          byrow = TRUE)))
})

Try the tablespan package in your browser

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

tablespan documentation built on April 3, 2025, 9:21 p.m.