
Last chance! 50% off unlimited learning
Sale ends in
A minimal Markdown table generator using the pipe |
as column separators.
md_table(x, digits = NULL, na = NULL, newline = NULL, limit = NULL)
A character vector.
A 2-dimensional object (e.g., a matrix or data frame).
The number of decimal places to be passed to round()
. It can
be a integer vector of the same length as the number of columns in x
to
round columns separately. The default is 3
.
A character string to represent NA
values. The default is an
empty string.
A character string to substitute \n
in x
(because pipe
tables do not support line breaks in cells). The default is a space.
The maximum number of rows to show in the table. If it is smaller than the number of rows, the data in the middle will be omitted. If it is of length 2, the second number will be used to limit the number of columns. Zero and negative values are ignored.
The default argument values can be set via global options with the prefix
xfun.md_table.
, e.g., options(xfun.md_table.digits 2, xfun.md_table.na = 'n/a')
.
knitr::kable()
(which supports more features)
xfun::md_table(head(iris))
xfun::md_table(mtcars, limit = c(10, 6))
Run the code above in your browser using DataLab