Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

label

Set a table label for external referencing


Description

The label is used as the table's label in LaTeX, and as the "id" property of the table element in HTML.

Usage

label(ht)
label(ht) <- value
set_label(ht, value)

Arguments

ht

A huxtable.

value

A string. Set to NA to reset to the default, which is "NA".

Details

LaTeX table labels typically start with "tab:".

Within knitr, huxtable labels will default to the same as the knitr chunk label. To turn off this behaviour, set options(huxtable.autolabel = FALSE).

If you use bookdown, and set a label on your table, the table caption() will automatically be prefixed with (#label). You can then refer to the table using @ref(label). label needs to start with "tab:"; if it doesn't, the "tab:" prefix will be added automatically. To turn off this behaviour, set options(huxtable.bookdown = FALSE).

Value

label() returns the label property. set_label() returns the modified huxtable.

See Also

huxtable-options

Examples

label(jams) <-  "tab:mytable"
label(jams)

huxtable

Easily Create and Style Tables for LaTeX, HTML and Other Formats

v5.3.0
MIT + file LICENSE
Authors
David Hugh-Jones [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.