prGetThead: Renders the table head (thead)

View source: R/htmlTable_render_getThead.R

prGetTheadR Documentation

Renders the table head (thead)

Description

Renders the table head (thead)

Usage

prGetThead(
  x,
  header = NULL,
  cgroup = NULL,
  n.cgroup = NULL,
  caption = NULL,
  compatibility,
  total_columns,
  css.cgroup,
  top_row_style,
  rnames,
  rowlabel = NULL,
  cgroup_spacer_cells,
  prepped_cell_css,
  style_list,
  cell_style
)

Arguments

x

The matrix/data.frame with the data. For the print and knit_print it takes a string of the class htmlTable as x argument.

header

A vector of character strings specifying column header, defaulting to colnames(x)

cgroup

A vector, matrix or list of character strings defining major column header. The default is to have none. These elements are also known as column spanners. If you want a column not to have a spanner then put that column as "". If you pass cgroup and n.crgroup as matrices you can have column spanners for several rows. See cgroup section below for details.

n.cgroup

An integer vector, matrix or list containing the number of columns for which each element in cgroup is a heading. For example, specify cgroup=c("Major_1","Major_2"), n.cgroup=c(3,3) if "Major_1" is to span columns 1-3 and "Major_2" is to span columns 4-6. rowlabel does not count in the column numbers. You can omit n.cgroup if all groups have the same number of columns. If the n.cgroup is one less than the number of columns in the matrix/data.frame then it automatically adds those.

caption

Adds a table caption.

compatibility

Is default set to LibreOffice as some settings need to be in old HTML format as Libre Office can't handle some commands such as the css caption-alignment. Note: this option is not yet fully implemented for all details, in the future I aim to generate a HTML-correct table and one that is aimed at Libre Office compatibility. Word-compatibility is difficult as Word ignores most settings and destroys all layout attempts (at least that is how my 2010 version behaves). You can additinally use the options(htmlTableCompat = "html") if you want a change to apply to the entire document. MS Excel sometimes misinterprets certain cell data when opening HTML-tables (eg. 1/2 becomes 1. February). To avoid this please specify the correct Microsoft Office format for each cell in the table using the css.cell-argument. To make MS Excel interpret everything as text use "mso-number-format:\"\@\"".

total_columns

The total number of columns including the rowlabel and the specer cells

top_row_style

The top row has a special style depending on the ctable option in the htmlTable call.

rnames

Default row names are generated from rownames(x). If you provide FALSE then it will skip the row names. Note: For data.frames if you do rownames(my_dataframe) <- NULL it still has row names. Thus you need to use FALSE if you want to supress row names for data.frames.

rowlabel

If the table has row names or rnames, rowlabel is a character string containing the column heading for the rnames.

cgroup_spacer_cells

The spacer cells due to the multiple cgroup levels. With multiple rows in cgroup we need to keep track of how many spacer cells occur between the columns. This variable contains is of the size ncol(x)-1 and 0 if there is no cgroup element between.

style_list

The list with all the styles

Value

string Returns the html string for the ⁠<thead>...</thead>⁠ element


gforge/htmlTable documentation built on Nov. 4, 2023, 12:05 a.m.