combine_table: Combine html tables

View source: R/utils2.R

combine_tableR Documentation

Combine html tables

Description

Wrapper to easily combine a list of data frames or matrices into html tables using the htmlTable package. combine_table2 can join tables vertically or horizontally (common column and row names are not required).

Usage

combine_table(x, tspanner, n.tspanner, ...)

combine_table2(
  x,
  tspanner,
  n.tspanner,
  cgroup,
  n.cgroup,
  how = c("rbind", "cbind"),
  ...
)

Arguments

x

a list of matrices or data frames

tspanner, n.tspanner

table spanner labels and number of rows, respectively, passed to htmlTable; if missing, names(x) and sapply(x, nrow) are used

...

additional arguments passed to htmlTable

cgroup, n.cgroup

table column labels and number of columns for each, respectively, passed to htmlTable; if missing, names(x) and sapply(x, ncol) are used

how

method to join objects, by row ("rbind") or column ("cbind") binding

Examples

sp <- lapply(split(mtcars, rep(1:3, c(1, 11, 20))), as.matrix)

## basic table
combine_table(sp)
combine_table(sp, letters[1:3], c(2, 5, 25))

## adding more options
combine_table(
  caption = 'Table 1: <code>mtcars</code> data set',
  sp, tspanner = sapply(sp, function(x) num2char(nrow(x))),
  css.cell = 'padding: 0 10 5px;',
  css.tspanner = 'text-align: center; color: red; font-style: italic;'
)

combine_table2(sp, how = 'c', cgroup = LETTERS[1:3])


raredd/rawr documentation built on March 4, 2024, 1:36 a.m.