Splitting table to multiple pages using tablegrob

261 Views Asked by At

What is the best way to split a table to multiple pages? When table goes more than one page, only the first page is shown and not the rest.

      library(gridExtra)
      library(gtable)
      library(gdata)

      table = tableGrob(rowCountDf)
      title = textGrob("Row count of different tables ", gp = gpar(fontsize = 18))
      padding = unit(0.5,"line")
      table = gtable_add_rows(table, heights = grobHeight(title) + padding, pos = 0 )
      table = gtable_add_grob(  table, list(title),   t = 1, l = 1, r = ncol(table)  )
      table = gtable_add_grob(table,
                              grobs = rectGrob(gp = gpar(fill = NA, lwd = 2)),
                              t = 2, b = nrow(table), l = 1, r = ncol(table))
      table = gtable_add_grob(table,
                              grobs = rectGrob(gp = gpar(fill = NA, lwd = 2)),
                              t = 1, l = 1, r = ncol(table))
0

There are 0 best solutions below