R - adding page numbers to PDF

后端 未结 4 852
天涯浪人
天涯浪人 2021-01-14 19:26

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 ( ...          


        
4条回答
  •  失恋的感觉
    2021-01-14 20:12

    library(ggplot2)
    plots = replicate(8, qplot(1,1))
    library(gridExtra)
    p <- 
    do.call(marrangeGrob, c(plots, list(ncol=2, nrow=2, top =NULL, 
            bottom = quote(quote(paste(g, "/",pages))))))
    
    p
    
    ggsave("multipage.pdf", p)
    

    (the quote(quote()) is needed to maintain lazy evaluation, somehow)

提交回复
热议问题