print to pdf file using grid.table in r - too many rows to fit on one page

后端 未结 6 1774
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 11:53

I\'m trying to output a dataframe of about 40 rows and 5 columns to a .pdf file using grid.table in gridExtra package of R.

However, 40 rows is too long for a page

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 12:20

    I just used a hack. I printed the table to html using R2HTML and then I converted the html to pdf using wkhtmltopdf.

    in R:

    library(R2HTML)
    HTML(table, file="table.html")
    

    in the shell

    wkhtmltopdf table.html table.pdf
    

提交回复
热议问题