styledTables is an R package that makes it possible to export a data.frame as beautifully styled Excel and LaTeX table.

Produce tables, which you want to look at.

Create your first styled table

Use the styled_table() function to turn a data.frame or matrix into a StyledTable class object. Then apply all the [styling functions] you want to by using the pipe operator %>% and return the StyledTable object at the end of your Rmd chunk so that knitr can do the printing (the print() function of knitr is overloaded by styledTables).

Concat styled tables vertically

The function styled_table() allows you to put in multiple data.frames/StyledTable objects/matrices, which will be concatenated vertically. This may be particularly useful for adding a custimized table header to the table. With the functions merge_cells() and merge_equal_cells() multiple cells of a StyledTable object can be merged together.

Export to Excel

For the creation of Excel tables the xlsx package is used. Create a xlsx workbook and use the write_excel() function to insert the StyledTable object in a worksheet.

Resulting Excel file

Export to PDF or PNG

Use the function write_pdf() and write_png() to create PDF and PNG images of the styled table.

Resulting pdf file and Resulting png file

Include in Rnw

The function create_latex_table() returns the LaTeX code of the StyledTable object. You can use this function to include your StyledTable inside of an Rnw file. Therefore you must load several LaTeX packages in the LaTeX preamble (before \begin{document}):

Rnw file and Resulting PDF file