Prints tables (i.e. data frame) in different output formats.

# S3 method for class 'describe_posterior'
display(object, format = "markdown", ...)

# S3 method for class 'describe_posterior'
print(x, digits = 2, caption = "Summary of Posterior Distribution", ...)

# S3 method for class 'describe_posterior'
print_html(x, digits = 2, caption = "Summary of Posterior Distribution", ...)

# S3 method for class 'describe_posterior'
print_md(x, digits = 2, caption = "Summary of Posterior Distribution", ...)

Arguments

object, x

An object returned by one of the package's function, for example describe_posterior(), point_estimate(), or eti().

format

String, indicating the output format. Can be "markdown" "html", or "tt". format = "tt" creates a tinytable object, which is either printed as markdown or HTML table, depending on the environment. See insight::export_table() for details.

...

Arguments passed down to print_html() or print_md() (e.g., digits), or to insight::export_table().

digits

Integer, number of digits to round the table output. Defaults to 2.

caption

Character, caption for the table. If NULL, no caption is added. By default, a caption is created based on the object type.

Value

If format = "markdown", the return value will be a character vector in markdown-table format. If format = "html", an object of class gt_tbl. If format = "tt", an object of class tinytable.

Details

display() is useful when the table-output from functions, which is usually printed as formatted text-table to console, should be formatted for pretty table-rendering in markdown documents, or if knitted from rmarkdown to PDF or Word files. See vignette for examples.

Examples

if (FALSE) { # all(insight::check_if_installed(c("tinytable", "gt"), quietly = TRUE))
# \donttest{
d <- data.frame(replicate(4, rnorm(20)))
result <- describe_posterior(d)

# markdown format
display(result)

# gt HTML
display(result, format = "html")

# tinytable
display(result, format = "tt")
# }
}