The function adds a reference label to the caption so that pander tables can be cross-referenced in bookdown using the \@ref(tab:label) syntax. The function should only be used in pander(x, caption = add_label()).

add_label(caption = "", tag = "tab")

Arguments

caption

The caption text as a string

tag

The tag to use as a prefix. Default is tab.

Value

The caption text prefixed with a reference label.

Examples

add_label("caption text")
#> [1] "(\\#tab:)caption text"