A follow-up question to this: R save table as image
Is there any way to add Custom Titles and Headings to images generated by the following code?
library(ggplot2)
library(gridExtra)
df <- data.table(a=1:10, b=11:20,c=21:30, d=31:40)
png("test.png")
p<-tableGrob(df)
grid.arrange(p)
dev.off()
The above code gives me the following output:
I want to add titles to the image and save them as files on my disk, so that I can use them in other documents and presentations.
Expecting something like this:
Or if there's a smarter way to do it in R, it would be very helpful. Again, all I am trying to do is create tables and export them to individual image files (that have appropriate titles in the images).