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: 
With Spaceman's answer, I was able to come up with a solution that does not rely on `latex` from the `Hmisc` package as `latex` was causing some path problems for me: 

```
table.png <- function(obj, name) { 
first <- name
name <- paste(name,".tex",sep="")
sink(file=name)
cat('
\\documentclass{report}
\\usepackage[paperwidth=5.5in,paperheight=7in,noheadfoot,margin=0in]{geometry}
\\begin{document}\\pagestyle{empty}
')
print(xtable(obj))
cat('
\\end{document}
')
sink()
texi2dvi(file=name)
cmd <- paste("dvipng -T tight", shQuote(paste(first,".dvi",sep="")))
invisible(sys(cmd))
cleaner <- c(".tex",".aux",".log",".dvi")
invisible(file.remove(paste(first,cleaner,sep="")))
}

```
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)