Exporting R tables to HTML

The xtable function in the xtable package can export R tables to HTML tables. This blog entry describes how you can create HTML pages from Sweave documents.


It might be worth mentioning that there has been a new package specifically designed to convert (and style with css) data.frames (or tables) into HTML tables in an easy and intuitive way. It is called tableHTML. You can see a simple example below:

library(tableHTML)
#create an html table 
tableHTML(mtcars)

#and to export in a file
write_tableHTML(tableHTML(mtcars), file = 'myfile.html')

You can see a detailed tutorial here as well.

Tags:

Html

Export

R