odfTable {odfWeave} | R Documentation |
Create an Open Document Format table from a data frame, matrix or vector
odfTable(x, ...) ## S3 method for class 'numeric' odfTable(x, horizontal = length(x) < 5, colnames = names(x), digits = max(3, getOption("digits") - 3), name = paste("Table", floor(runif(1) * 1000), sep = ""), styles = NULL, ...) ## S3 method for class 'character' odfTable(x, horizontal = length(x) < 5, colnames = names(x), name = paste("Table", floor(runif(1) * 1000), sep = ""), styles = NULL, ...) ## S3 method for class 'data.frame' odfTable(x, colnames = NULL, useRowNames = TRUE, digits = max(3, getOption("digits") - 3), name = paste("Table", floor(runif(1) * 1000), sep = ""), styles = NULL, cgroup = NULL, rgroup = NULL, ...) ## S3 method for class 'matrix' odfTable(x, colnames = NULL, useRowNames = TRUE, digits = max(3, getOption("digits") - 3), name = paste("Table", floor(runif(1) * 1000), sep = ""), styles = NULL, cgroup = NULL, rgroup = NULL, ...)
x |
A vector, matrix or data frame. |
horizontal |
A logical: should the vector be shown as a 1xn table or nx1? This is ignored for other data structures. |
colnames |
A vector of column names that can be used. Note that if the row names are used in the table, this should contain an extra element for that column. |
useRowNames |
A logical: should the row names be printed in the final table. |
digits |
Number of significant digits passed to |
name |
A name for the table. ODF requires a name for each object, so a random name will be used if unspecified. |
styles |
An optional list of style names for each table element
(cells, headers etc). See |
cgroup |
A data frame with two, three, or four columns.
The first column should be a character vector specifying column group header names.
The resulting row will come before the header names specified via the
|
rgroup |
A data frame with two, three, or four columns.
The first column should be a character vector specifying row group header names.
The second column should be a numeric vector specifying the row span for the
corresponding element of the first column.
The sum of the second column must be equal to the number of rows in |
... |
Optional arguments that can be passed to |
The data structures are converted to character matrices using format
.
The justify
and trim
arguments to format
are usually
overridden by the table style options, so those arguments are automatically set
to justify = "none"
and trim = TRUE
. However, if values of these
arguments are passed using the three dots, format will use them (but they
probably won't do anything).
When using odfTable
in a code chunk, the chunk's results
argument should be set to xml
.
The document formatting.odt in the package's examples directory illustrates the process of changing the appearance of the table.
a list of character string that contain XML markup
Max Kuhn, with contributions from Zekai Otles
odfTable(iris[1:5,])