[R] fit printed output onto a single page

Jim Lemon jim at bitwrit.com.au
Wed May 5 11:05:46 CEST 2010

On 05/05/2010 12:12 AM, Abiel X Reinhart wrote:
> Is there a way to force a certain block of captured output to fit onto a single printed page, where one can specify the properties of the page (dimensions, margins, etc)? For example, I might want to generate 10 different cuts of a data table and then capture all the output into a PDF, ensuring that each run of the data table fits onto a single page (i.e. the font-size of the output may have to be dynamically adjusted).
Hi Abiel,
One way that comes to mind is to display the block of text on a graphics 
device like postscript. First open the postscript device and create an 
empty plot:

# notice how culturally sensitive I am, using "letter" size paper!
# set the margins to zero or something narrow

Then work out whether your block of text will fit into the plot:

# this should get the reduction (or expansion) to make it fit


This is off the top of my head (which is a bit dented at the moment) so 
you might want to try it out first.


More information about the R-help mailing list