Open elipousson opened 1 week ago
I took a closer look at the documentation and figured this out that works for both gt tables and list columns containing gt table objects (I think):
knitr::opts_chunk$set(
.transformer = epoxy_transform_inline(
.gt = \(x) {
if (inherits(x, "gt_tbl")) {
return(knitr::knit_print(x))
}
lapply(x, knitr::knit_print)
},
)
)
I didn't realize initially that I could set additional transformation options with epoxy_transform_inline()
without over-writing all of the built-in styles.
Nice! Also you can use epoxy_transform_set() to define the .gt
inline transformer.
epoxy_transform_set(
.gt = \(x) {
if (inherits(x, "gt_tbl")) {
return(knitr::knit_print(x))
}
lapply(x, knitr::knit_print)
},
)
Of course, as I'm looking at this snippet, I think maybe epoxy could handle calling knit_print()
or at least could provide a .knit_print
transformer.
I am using epoxy to produce a report that includes text elements mixed in with tables. The vectorized inline reporting chunks are really useful for the text elements and I'm interested in using the same approach to include the
gt
tables or plots created with ggplot2.Is there a recommended process for customizing epoxy for this type of use?
I looked (but have not yet tried) using the
transformer
argument to customize the formatting of gt objects (or other elements). However, I was unsure how to keep the default transformer in place and add instead of replace the available inline transformers.Thanks for the package and any additional tips you can share!