Closed hope-data-science closed 2 years ago
This is possible with markdown tables, but it appears there is an issue with the PDF format. Something like this should (but doesn't completely) work:
@Book{plotly,
author = {Carson Sievert},
title = {{Interactive Web-Based Data Visualizatio}n with R, plotly, and shiny},
publisher = {Chapman and Hall/CRC},
year = {2020},
isbn = {9781138331457},
url = {https://plotly-r.com},
}
@Manual{crosstalk,
title = {{crosstalk}: Inter-Widget Interactivity for HTML Widgets},
author = {Joe Cheng and Carson Sievert},
year = {2021},
note = {R package version 1.1.1},
url = {https://CRAN.R-project.org/package=crosstalk},
}
```{r}
tbl <- tibble::tribble(
~ package, ~ reference,
"plotly", "[@plotly]",
"crosstalk", "[@crosstalk]"
)
knitr::kable(tbl, escape = FALSE)
![image](https://user-images.githubusercontent.com/16127127/159583937-becdd27a-cdd0-4163-8528-2d10cb42be9f.png)
I've poked around a bit more into this issue and found that [@cite]
doesn't work when in a LaTeX tabular environment (which kable()
produces).
Instead set kable()
to produce some form of markdown table, which will correctly be picked on by pandoc and converted to a proper citation. For example:
```{r}
tbl <- tibble::tribble(
~ package, ~ reference,
"plotly", "[@plotly]",
"crosstalk", "[@crosstalk]"
)
knitr::kable(tbl, escape = FALSE, format = "simple")
![image](https://user-images.githubusercontent.com/16127127/190045608-3aaee29b-6a26-4741-a922-2da28fa900b3.png)
Note, you will also need to load in the `longtables` tex package for pandoc tables to work:
```yaml
header-includes: '\usepackage{longtable}'
I hope to make this automatic, but it is difficult at the moment due to how we handle tex dependencies in a separate wrapper file (legacy reasons).
In the template (https://rjournal.github.io/rjtools/articles/article_template.html), we can learn how to include data tables in
rjtools
. Is there a way to include tables as provided in https://dereksonderegger.github.io/570L/15-rmarkdown-tricks.html? Currently, I could not find a way to use other formats in the table (e.g. I might want to include a\CRANpkg{}
or[@]
for reference in the table). How can I make a table like below (the references have links):Thanks.