Data frame and Tables Pretty Formatting
Data frame and Tables Pretty Formatting
export_table( x, sep = " | ", header = "-", empty_line = NULL, digits = 2, protect_integers = TRUE, missing = "", width = NULL, format = NULL, title = NULL, caption = title, subtitle = NULL, footer = NULL, align = NULL, group_by = NULL, zap_small = FALSE, verbose = TRUE )
x |
A data frame. |
sep |
Column separator. |
header |
Header separator. Can be |
empty_line |
Separator used for empty lines. If |
digits |
Number of significant digits. May also be |
protect_integers |
Should integers be kept as integers (i.e., without decimals)? |
missing |
Value by which |
width |
Minimum width of the returned string. If not |
format |
Name of output-format, as string. If |
title, caption, subtitle |
Table title (same as caption) and subtitle, as strings. If |
footer |
Table footer, as string. For markdown-formatted tables, table footers, due to the limitation in markdown rendering, are actually just a new text line under the table. |
align |
Column alignment. For markdown-formatted tables, the default
|
group_by |
Name of column in |
zap_small |
Logical, if |
verbose |
Toggle messages and warnings. |
A data frame in character format.
The values for caption
, subtitle
and footer
can also be provided as attributes of x
, e.g. if caption = NULL
and x
has attribute table_caption
, the value for this
attribute will be used as table caption. table_subtitle
is the
attribute for subtitle
, and table_footer
for footer
.
cat(export_table(iris)) cat(export_table(iris, sep = " ", header = "*", digits = 1)) ## Not run: # colored footers data(iris) x <- as.data.frame(iris[1:5, ]) attr(x, "table_footer") <- c("This is a yellow footer line.", "yellow") cat(export_table(x)) attr(x, "table_footer") <- list( c("\nA yellow line", "yellow"), c("\nAnd a red line", "red"), c("\nAnd a blue line", "blue") ) cat(export_table(x)) attr(x, "table_footer") <- list( c("Without the ", "yellow"), c("new-line character ", "red"), c("we can have multiple colors per line.", "blue") ) cat(export_table(x)) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.