A caption for a table can be created in two ways: either directly when you
provide both text=
and table=
, or indirectly, when you call Table()
within an R chunk with table=
not provided. In that case, the caption is
saved for later use, and tab()
retrieves it when needed. The label of the
table is automatically set to the label of the chunk.
Table(text = NULL, table = NULL, label = NULL, hold = NULL) tab(..., hold = FALSE) # S3 method for knitr_asis print(x, ..., sep = "\n")
text | The text of the caption. It can contain Markdown formatting. |
---|---|
table | The textual description of the table (in plain Markdown). |
label | The label to use (not required if the function is run from within an R chunk because the chunk label is used by default). |
hold | Should we save the caption for later use, and return invisibly?
Default value is |
... | Same arguments as for |
x | Any R object to print. |
sep | Separator to use for printing multiple strings. |
The caption with a code to number the table is returned (invisibly, if
hold = TRUE
).
Table("This is my caption", " | x | y | |:---:|:---:| | 1 | 2 | | 3 | 5 | ")#> Table: This is my caption #> #> | x | y | #> |:---:|:---:| #> | 1 | 2 | #> | 3 | 5 | #>