Description Usage Arguments Value Examples
Wraps table functions to provide a single user interface. A footer can be added but this requies rows to be merged once the document has been knit to word.
1 2 | pretty_table(df, col_names = NULL, footer = NULL, cap_fun = pretty_tabref,
label = NULL, caption = NULL, tab_fun = pander, ...)
|
df |
A data frame to be converted to a markdown table. Optionally a vector can be passed, this will be reformatted into a data frame with the vectors names used in the firt column. |
col_names |
A character vector of replacement column names. |
footer |
The desired footer as a character string. |
cap_fun |
Caption function to wrap, if supplied pretty_table defaults to defining an empty caption. |
label |
A character string of the reference label for the table |
caption |
A character string of the required table caption. |
tab_fun |
Table function to wrap. Supported functions are |
... |
Pass additional arguements to the wrapped table function. |
A markdown table
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## A simple table
pretty_table(iris[1:5, 1:5])
## Renaming columns
pretty_table(iris[1:5, 1:5], col_names = as.character(1:5))
## Adding a footer
pretty_table(iris[1:5, 1:5], footer = 'Example footer')
## Changing to a kable table
library(knitr)
pretty_table(iris[1:5, 1:5], tab_fun = kable)
## Passing a named vector of values
pretty_table(c(b = 1, c = 2, a = 3))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.