insight (version 0.11.0)

export_table: Data frame and Tables Pretty Formatting

Description

Data frame and Tables Pretty Formatting

Usage

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 )

Arguments

x

A data frame.

sep

Column separator.

header

Header separator. Can be NULL.

digits

Number of significant digits.

protect_integers

Should integers be kept as integers (i.e., without decimals)?

missing

Value by which NA values are replaced. By default, an empty string (i.e. "") is returned for NA.

width

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.

format

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.

caption, subtitle

Table caption and subtitle, as string. If NULL, no caption or subtitle is printed.

align

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.

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.

zap_small

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.

Value

A data frame in character format.

Examples

Run this code
# NOT RUN {
cat(export_table(iris))
cat(export_table(iris, sep = " ", header = "*", digits = 1))
# }

Run the code above in your browser using DataLab