I am hoping to use R to produce a 1 page report that is to be laid out as follows:
topleft:
plot 1 plot 2
plot 3 plot 4
Topright: plot 5 (4x as big as plots 1:4)
Bottomright: Table
This page will then be rerun ~100 times so that each page of the report is identical but each page is just for a different store in this case.
I was hoping to do this using ggplot
for the 5 plots. I can produce all 6 items separately but I really have no clue how to go about setting them neatly onto 1 page in the layout above.
I have read a little bit on LaTex
but not sure if I'm just wasting time. I like the base layout()
and par(mfrow)
capabilities but I don't know what to do here seeing as I need similar functionality for ggplot2
plots.
So the topleft 4 plots can be done using something like:
library(gridExtra)
grid.arrange(plot1,plot2,plot3,plot4,ncol=2,nrow=2)
What I really need is something like
grid.arrange(plot1,plot2,(no plot),(no plot),plot3,plot4,(no plot),(no plot),
ncol=4,nrow=3)
Something like this would prepare the plot region for plot 5 in the top right and leave space down the bottom for the table.
So my questions are
- is how would I get plots 1:4 (same size) and plot 5 (4x as big as plots 1:4) all onto the page as planned using ggplot2 plots?
- How would I then get a table on the bottom right?
I like the look of this table:
grid.table
function from gridExtra
package.
The table I need will be 6 rows * 5 columns. Something like:
grid.table(head(iris))
The only issue is that it always gets thrown right into the middle and I don't know how to control it so that it sits bottom right.
Any suggestions?