Closed statzhero closed 4 years ago
You can try the pagedown package... It produces imperfect results for now, but will try and fix the inner-cell table borders showing.
remotes::install_github('rstudio/pagedown')
library(pagedown)
library(summarytools)
setwd("~/R")
print(dfSummary(iris), file = "iris_dfs.html")
chrome_print(input = "iris_dfs.html",
output = "iris_dfs.pdf",
format = "pdf")
shell.exec("iris_dfs.pdf")
Another -- and better, I think -- option is this piece of software (wkhtmltopdf).
On Windows, add the C:\Program Files\wkhtmltopdf\bin
directory to your system's PATH, and then you can do this:
setwd("~/R")
system("wkhtmltopdf --javascript-delay 1 iris_dfs.html iris_dfs.pdf")
shell.exec("iris_dfs.pdf")
... and the undesired table borders don't show up using this tool.
What's the quickest way to directly output a table to PDF? Here's a use case in pseudo-code:
dfSummary(dt, method = "pdf") %>% print(file = "table.pdf")