library(knitr) library(magrittr) library(reactable) library(ggplot2) knitr::opts_chunk$set(echo = TRUE, message = FALSE) ##### Set default print options for data.frame/reactable ##### # register the default methods for print dfs/reactable registerS3method("knit_print", "data.frame", Rmdplate::knit_print_df) registerS3method("knit_print", "reactable", Rmdplate::knit_print_reactable) ##### Set defaults for ggplots ##### old_theme <- theme_set(ggpubr::theme_pubr())
Aim: What's the major aim of this .Rmd?
Cross-referencing of tables is as yet not available for reactable
(https://github.com/glin/reactable/issues/15). Therefore, I've attempted a workaround based off https://cran.r-project.org/web/packages/knitr/vignettes/knit_print.html. To use this, you need to add a fig.cap
to the table in the format 'fig.cap = "key: table caption"', then refer the table with \@ref(tab:key)
- for example \@ref(tab:iris-table).
iris_10 <- data.frame(iris[1:10,]) iris_10
Making sure this also works for reactable
s \@ref(tab:iris-reactable).
iris_10
For figures, need to make sure your keys don't have a "_" in them and have fig.cap = "figure caption"
to refer to them in the text (\@ref(fig:iris-figure))
iris_10 %>% ggplot(aes(x = Sepal.Length, y = Sepal.Width) ) + geom_point()
Show/hide
library("sessioninfo") options(width = 120) session_info()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.