Question: Is there a way to print, from within R, a LaTeX table directly to an image file (for inclusion in another document/webpage). Basically, I'd like to supply LaTeX code to a function that saves it as an image to the working directory. 

Pipe dreams?

Answer: 
xtable provides the option to output either latex or html markup. You could put the html in directly.

Having said that I too would like to be able to go directly from knit or sweave to png or svg. I was trying to do this just last week. I am building an inkscape infographic (svg) and have been looking for a way to insert a linked image of a table that updates by running R code.

In initial testing I combined the use of xtable and Spacedman's (+1) code to get some nice png output (Ubuntu). -D option allows controlling of resolution.

I'm looking into a dvi->svg converter which is more like what I am after.
<http://dvisvg.sourceforge.net/>

```
dvipng.dvi <- function (object, file, res=600)
{
    if (missing(file)){
        invisible(sys(
                paste("dvipng -T tight", "-D", res, shQuote(object$file)))
            )
}
    else{
        invisible(sys(
                paste("dvipng -T tight", "-D", res, "-o", file, shQuote(object$file)))
            )
    }
}

tt <- head(iris)

dvipng.dvi(dvi.latex(latex(xtable(tt))), file='iris.png')

```
The [kableExtra](http://haozhu233.github.io/kableExtra/) package allows to make nice and customized tables via LaTeX or HTML. It also has a function to export such standalone tables to, for example, PNG or PDF via webshot. Here is an example:

```
library(kableExtra)
knitr::kable(mtcars[1:6, 1:5], "latex", booktabs = TRUE, linesep = "") %>% 
    kable_styling(full_width = TRUE, font_size = 12) %>% 
    column_spec(1, width = "4cm") %>% 
    save_kable(file = "table.png")

```

[![Export table to png using kableExtra](https://i.stack.imgur.com/wYlhE.png)](https://i.stack.imgur.com/wYlhE.png)