dt_table_caption: Print caption for DT::datatable in bookdown

Description Usage Arguments Value Examples

View source: R/table_utils.R

Description

'dt_table_caption()' print the HTML tags of table caption for table generated by package DT, which is a HTML widget that cannot be labeled using table numbering system hence is reference-able. The chunk option ‘result=’asis'' should be **set** when using this function since the HTML tag of caption should be considered as part of the document output.

Usage

1
dt_table_caption(text_ref_str, caption = NA)

Arguments

text_ref_str

a character that can be **text reference** or **label**, e.g., "(ref:ref-name)" or "ref-name". Note that it **cannot** parse '-' in character.

caption

a character ot NA, default NA. The caption of table is the name of **text reference** when it set NA, or you can specify a character as the caption of table instead of it.

Value

None (invisible 'NULL')

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Type one
t1 <- "(ref:text-ref-name)"
dt_table_caption(t1)
# Type two
t2 <- "text-ref-name"
dt_table_caption(t2)
# possible mistakes and the behaviors
t3 <- "ref:text-ref-name"
dt_table_caption(t3)
t4 <- "text_ref_name"
dt_table_caption(t4)

YuanchenZhu2020/antgreens documentation built on Dec. 18, 2021, 8:20 p.m.