ggplot2 - R - How to print more than three tables on one page in a PDF -


i trying create multiple page pdf file r contains both data.frames , ggplots. managed transforming data.frames grobs , using grid.arrange function.

the problem have want print 5 tables/grobs on first page in pdf, 1 below another. on page 2 want 1 table contains different kinds of data. page 3 contain ggplot. works fine put 3 tables on 1 page try 4 or more print them in 2 columns , overlap.

here tried now:

# load required packages library(gridbase) library(gridextra) library(ggplot2)  # transform tables grobs table1 <- tablegrob(df1) table2 <- tablegrob(df2) table3 <- tablegrob(df3) table4 <- tablegrob(df4) table5 <- tablegrob(df5) table6 <- tablegrob(df6)  # create pdf file  pdf("file.pdf", height = 15, width = 20) layout(matrix(c(1,2,3,4,5,6), 1, 6, byrow = true)) grid.arrange(table1, table2, table3, table4, table5) grid.arrange(table6) grid.arrange(ggplot1) dev.off() 

does know i'm wrong?

thanks lot in advance!

cheers, tilman

this first page of pdf looks use more 3 tables. want them in 1 column

just solved - , of course there's easy solution did not think about.

grid.arrange(table1, table2, table3, table4, table5, ncol = 1, nrow = 5) 

just adding ncol , nrow makes deal.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -