I use the package captioner to automatically reference tables, figures, supplementary data, codes, etc in my normal work. Althoug I can use it efficiently, I would like to create a section in the RMarkdown document which contains the list (index) of all the elements of the same style.
Let's say I have 2 tables in a RMarkdown document.
---
title: "Untitled"
author: "Mario Modesto Mata"
date: "6/7/2020"
output:
pdf_document: default
html_document: default
---
```{r setup, include=FALSE}
library(captioner)
table_number <- captioner(prefix = "Table")
```
The data frame of mtcars is in `r table_number("table1", display="cite")`.
```{r}
data(mtcars)
print(mtcars)
```
`r table_number(name = "table1", caption = "Caption of table1 (mtcars)")`
The data frame of mtcars is in `r table_number("table2", display="cite")`.
```{r}
data(iris)
print(iris)
```
`r table_number(name = "table2", caption = "Caption of table2 (iris)")`
I would like to include at the beginning an index of the tables that were defined with the function table_number().
Is there a way to do this? I would prepare later the equivalent index for figures and other topics...