[R] Graphical table in R

Marc Schwartz MSchwartz at MedAnalytics.com
Mon Jan 10 15:09:34 CET 2005


On Mon, 2005-01-10 at 11:05 +0000, Dan Bolser wrote:
> I would like R to produce some tabulated data in a graphical output. When
> I say tabulated data, what I mean is a table with rows and columns. This
> would be useful when reading in a big file, performing some analysis on
> it, and then wanting to display the results as a table.
> 
> Something like 
> 
> plot(x,...)
> 
> where x is a matrix
> 
> For example, the result could look (approximatly) like...
> 
> +-------+-----------+
> |     A |         B |
> +-------+-----------+
> |     1 |     33278 |
> |     2 |      6790 |
> ...
> |    10 |         1 |
> |    12 |         6 |
> +-------+-----------+
> 
> 
> I havent (and cant) see any way to do this. Is there currently any way to
> do this? I imagine it could be put together with various other plotting
> 'fundamentals', but the syntax of the layout format could be a pain to get
> right. 
> 
> OK, I just found xtable (Export tables to LaTeX or HTML). Any plans to
> make a print.xtable(x,type="X",...) or print.xtable(x,type="png",...) function?
> 
> Any easy way to convert a latex table to an image without actually doing
> 
> latex latex.table.file.tex
> 
> dvi2png latex.table.file.dvi
> 
> ?

It is not entirely clear what you want to do with the table once you
have created it. That piece of information might be helpful in
attempting to offer some ideas.

In lieu of that, here are some additional pointers:

1. Review the output and code for:

demo(plotmath)


2. Review the latex() and html() functions in Frank Harrell's Hmisc
package, which provide additional functionality along with xtable().


3. Review these two posts regarding a general approach to plotting
tables:

http://tolstoy.newcastle.edu.au/R/help/02b/0345.html
http://tolstoy.newcastle.edu.au/R/help/02b/0342.html


HTH,

Marc Schwartz




More information about the R-help mailing list