rimorob rimorob - 7 months ago 104
R Question

How do I fit a very wide grid.table or tableGrob to fit on a pdf page?

I have a fairly wide table (4/3 of page width) that I'm trying to print using grid.table or grid.arrange (via tableGrob) into a pdf file. The table goes beyond page boundaries and gets clipped. Is there a way to force grid.table/grid.arrange to scale the table to the print area?


I got this done using font sizes. Not the best solution (requires manual intervention) but maybe someone can contribute something more elegant.

termTable = tableGrob(terms, h.even.alpha=1, h.odd.alpha=1,  v.even.alpha=0.5, v.odd.alpha=1, core.just='left', rows=c(),
gpar.coretext =gpar(fontsize=8),
gpar.coltext=gpar(fontsize=10, fontface='bold'),
gpar.rowtext=gpar(fontsize=10, fontface='bold')