Learn R Programming

insight (version 0.6.0)

format_table: Dataframe and Tables Pretty Formatting

Description

Dataframe and Tables Pretty Formatting

Usage

format_table(x, sep = " | ", header = "-", digits = 2,
  protect_integers = TRUE, missing = "", width = NULL)

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.

Value

A data frame in character format.

Examples

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

Run the code above in your browser using DataLab