I have a data frame which I would like to write it to a pdf file in organized fashion.
For example, my df looks like this:
Date County Trade
1
The grid.table solution will be the quickest way to create a PDF for short tables, but this solution will not work as is if you have a table that's longer than 1 page. RStudio + knitr + longtable is probably the way to go to create nicely formatted PDFs. What you'll need is something like:
\documentclass{article}
\usepackage{longtable}
\begin{document}
<>=
library(xtable)
df = data.frame(matrix(rnorm(400), nrow=100))
xt = xtable(df)
print(xt,
tabular.environment = "longtable",
floating = FALSE
)
@
\end{document}
Pls see this post for more details.