addTable
Add a table into a document object
Add a table into a document object
Usage
addTable(doc, data, layout.properties, header.labels, groupedheader.row,
span.columns, col.types, columns.bg.colors, columns.font.colors, row.names,
...)
Arguments
- doc
document object
- data
(a
data.frame
ormatrix
object) to add- layout.properties
a
tableProperties
object to specify styles to use to format the table. optional- header.labels
a character whose elements define labels to display in table headers instead of colnames. Optional, if missing, headers will be filled with
data
column names.- groupedheader.row
a named list whose elements define the upper header row (grouped header). Optional. Elements of that list are
values
andcolspan
. Elementvalues
is a character vector containing labels to display in the grouped header row. Elementcolspan
is an integer vector containing number of columns to span for eachvalues
.- span.columns
a character vector specifying columns names where row merging should be done (if successive values in a column are the same ; if data[p,j]==data[p-1,j] )
- col.types
a character whose elements define the formatting style of columns via their data roles. Optional Possible values are : "character", "integer", "logical" , "double", "percent", "date", "datetime". If missing, factor and character will be formated as character , integer as integer and numeric as double.
- columns.bg.colors
A named list of character vector. Define the background color of cells for a given column. optional. Names are
data
column names and values are character vectors specifying cells background colors. Each element of the list is a vector of lengthnrow(data)
.- row.names
logical value - should the row.names be included in the table.
- columns.font.colors
A named list of character vector. Define the font color of cells per column. optional. A name list, names are
data
column names and values are character vectors specifying cells font colors. Each element of the list is a vector of lengthnrow(data)
.- ...
further arguments passed to or from other methods..
Details
The table below shows the display model used to format tables:
+--------------+---------------+
GROUPEDHEADER_1|GROUPEDHEADER_2|
+------+-------+-------+-------+
HEADER1|HEADER2|HEADER3|HEADER4|
+------+-------+-------+-------+
x[1,1]| x[1,2]| x[1,3]|| x[1,4]|
+------+-------+-------+-------+
x[2,1]| x[2,2]| x[2,3]|| x[2,4]|
+------+-------+-------+-------+
x[3,1]| x[3,2]| x[3,3]|| x[3,4]|
+------+-------+-------+-------+
See addTable.docx
or
addTable.pptx
or addTable.html
for examples.
Value
a document object
See Also
docx
, addTable.docx
,
addFlexTable.docx
, pptx
,
addTable.pptx
,
addFlexTable.pptx
, html
,
addTable.html
,
addFlexTable.html
, FlexTable