R - adding page numbers to PDF
I'm having trouble adding page numbers to PDFs. Here's how I'm inserting pages / plots: pdf( file = pdfFilePath , width = 11 , height = 8.5 ) for ( ... ) { grid.newpage() pushViewport( viewport( layout = grid.layout( 2 , 2 ) ) ) ... print 4 plots .... } onefile seems to name a file by the page number, but I want the page numbers to appear in the same file. Edit I've modified @Gavin's code sample to produce a working version of mixing graphic types to get page numbers: require(ggplot2) pdf( file = "FILE_PATH_TO_SAVE_PDF_HERE" , width = 11 , height = 8.5 ) par( oma = c ( 4 , 4 , 4 , 4 ) , mar=c(