pipe_table | R Documentation |
Convenience wrapper around knitr::kable(format = "pipe")
to create a Markdown pipe table.
pipe_table(
x,
incl_rownames = NULL,
strong_colnames = TRUE,
strong_rownames = TRUE,
align = NULL,
label = NULL,
digits = getOption("digits"),
format_args = list()
)
x |
Dataframe/tibble/matrix to be converted to a pipe table. |
incl_rownames |
Whether to include row names or not. A logical scalar or |
strong_colnames |
Whether or not to highlight column names by formatting them |
strong_rownames |
Whether or not to highlight row names by formatting them |
align |
Column alignment. Either |
label |
The table reference label. By default, the label is obtained
from |
digits |
Maximum number of digits for numeric columns, passed to
|
format_args |
A list of arguments to be passed to |
Missing values (NA
) in the table are displayed as NA
by
default. If you want to display them with other characters, you can set the
option knitr.kable.NA
, e.g. options(knitr.kable.NA = '')
to
hide NA
values.
You can set the option knitr.kable.max_rows
to limit the number of
rows to show in the table, e.g., options(knitr.kable.max_rows = 30)
.
A character vector.
This function can be useful to create tables inside roxygen2 documentation programmatically from data using dynamic R code.
For example, the inline code
`r mtcars |> head() |> pipe_table()`
should produce the following table in roxygen2 7.1.0 and above:
mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb | |
Mazda RX4 | 21.0 | 6 | 160 | 110 | 3.90 | 2.620 | 16.46 | 0 | 1 | 4 | 4 |
Mazda RX4 Wag | 21.0 | 6 | 160 | 110 | 3.90 | 2.875 | 17.02 | 0 | 1 | 4 | 4 |
Datsun 710 | 22.8 | 4 | 108 | 93 | 3.85 | 2.320 | 18.61 | 1 | 1 | 4 | 1 |
Hornet 4 Drive | 21.4 | 6 | 258 | 110 | 3.08 | 3.215 | 19.44 | 1 | 0 | 3 | 1 |
Hornet Sportabout | 18.7 | 8 | 360 | 175 | 3.15 | 3.440 | 17.02 | 0 | 0 | 3 | 2 |
Valiant | 18.1 | 6 | 225 | 105 | 2.76 | 3.460 | 20.22 | 1 | 0 | 3 | 1 |
xfun::md_table()
Other (Pandoc) Markdown functions:
as_md_list()
,
as_md_val_list()
,
as_md_vals()
,
md_verb()
,
strip_md()
,
strip_md_footnotes()
mtcars |> head() |> pal::pipe_table() |> pal::cat_lines()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.