
Print tables in different output formats
Source:R/display.R
, R/print_md.R
display.performance_model.Rd
Prints tables (i.e. data frame) in different output formats.
Usage
# S3 method for class 'performance_model'
display(object, format = "markdown", digits = 2, caption = NULL, ...)
# S3 method for class 'performance_model'
print_md(
x,
digits = 2,
caption = "Indices of model performance",
layout = "horizontal",
...
)
# S3 method for class 'compare_performance'
print_md(
x,
digits = 2,
caption = "Comparison of Model Performance Indices",
layout = "horizontal",
...
)
Arguments
- object, x
An object returned by one of the package's function, for example
model_performance()
,compare_performance()
, orcheck_itemscale()
.- format
String, indicating the output format. Can be
"markdown"
"html"
, or"tt"
.format = "tt"
creates atinytable
object, which is either printed as markdown or HTML table, depending on the environment. Seeinsight::export_table()
for details.- digits
Number of decimal places.
- caption
Table caption as string. If
NULL
, no table caption is printed.- ...
Currently not used.
- layout
Table layout (can be either
"horizontal"
or"vertical"
).
Value
A character vector. If format = "markdown"
, the return value
will be a character vector in markdown-table format.
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
model <- lm(mpg ~ wt + cyl, data = mtcars)
mp <- model_performance(model)
display(mp)
#>
#>
#> |AIC | AICc | BIC | R2 | R2 (adj.) | RMSE | Sigma |
#> |:------|:------:|:------:|:----:|:---------:|:----:|:-----:|
#> |156.01 | 157.49 | 161.87 | 0.83 | 0.82 | 2.44 | 2.57 |