I have created a beautiful table in R using the 'reactable' pkg/function. I can export (in effect, knit) it as an HTML page, but is there a way to export it as an image (and if so, automatically)? Not necessary, but here is some code:
x<-as.data.frame(list(a=c("why","can't","I","figure","this","out"),b=c("it","is","probably","something","really","simple")))
reactable(x)
Here's an example of saving a Reactable table as an HTML file using saveWidget
then using that file and webshot2
to create a .png. Does this help?
library("reactable")
library("htmlwidgets")
library("webshot2")
html_file <- "table.html"
img_file <- "img.png"
df <- mtcars[1:3, 1:3]
table <- reactable(df)
saveWidget(widget = table, file = html_file, selfcontained = TRUE)
webshot(url = html_file, file = img_file, delay = 0.1, vwidth = 1245)