Hi there,
I trying to create a multi page PDF with several graphs and tables created with gt, one per page.
I can plot/print everything to the file, but with the gt object, only a blank page appears.
What is going on?
OUTPUT_FILE <- "xpto.pdf"
# from now on, everything happens inside a *for* loop
plot.new()
OBJPLOT<-plot(
Ad_hoc_object,
legend.loc = "left",
main = "Ad hoc title"
)
print (OBJPLOT) # this works, appears on the PDF
GT_OBJECT_TABLE <- gt(STRESS_TABLE,rownames_to_stub = TRUE)
GT_OBJECT_TABLE <-
GT_OBJECT_TABLE %>%
tab_header(
title = paste("Ad hoc Title"),
subtitle = paste("Ad hoc subtitle")
)
print(GT_OBJECT_TABLE) # This generates a graph... on the R Studio panel, not in the file
GT_OBJECT_TABLE # This does nothing but a blank page in the PDF
dev.off() # last line of the script and outside the *for* loop