Data frame and Tables Pretty Formatting
export_table(
x,
sep = " | ",
header = "-",
digits = 2,
protect_integers = TRUE,
missing = "",
width = NULL,
format = NULL,
caption = NULL,
subtitle = NULL,
align = NULL,
footer = NULL,
zap_small = FALSE
)format_table(
x,
sep = " | ",
header = "-",
digits = 2,
protect_integers = TRUE,
missing = "",
width = NULL,
format = NULL,
caption = NULL,
subtitle = NULL,
align = NULL,
footer = NULL,
zap_small = FALSE
)
A data frame.
Column separator.
Header separator. Can be NULL
.
Number of significant digits.
Should integers be kept as integers (i.e., without decimals)?
Value by which NA
values are replaced. By default, an empty string (i.e. ""
) is returned for NA
.
Minimum width of the returned string. If not NULL
and width
is larger than the string's length, leading whitespaces are added to the string.
Name of output-format, as string. If NULL
(or "text"
),
returned output is used for basic printing. Currently, only "markdown"
is
supported, or NULL
(the default) resp. "text"
for plain text.
Table caption and subtitle, as string. If NULL
,
no caption or subtitle is printed.
Column alignment. Only applies to markdown-formatted tables.
By default align = NULL
, numeric columns are right-aligned,
and other columns are left-aligned. May be a string to indicate alignment
rules for the complete table, like "left"
, "right"
,
"center"
or "firstleft"
(to left-align first column,
center remaining); or maybe a string with abbreviated alignment characters,
where the length of the string must equal the number of columns, for
instance, align = "lccrl"
would left-align the first column, center
the second and third, right-align column four and left-align the fifth
column.
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.
Logical, if TRUE
, small values are rounded after digits
decimal places. If FALSE
, values with more decimal places than digits
are printed in scientific notation.
A data frame in character format.
# NOT RUN {
cat(export_table(iris))
cat(export_table(iris, sep = " ", header = "*", digits = 1))
# }
Run the code above in your browser using DataLab