[R] Figures within tables [slightly off-topic]

Erik Iverson eriki at ccbr.umn.edu
Mon Apr 12 22:26:50 CEST 2010


Hello,

> I am writing a manuscript for a scientific journal in clinical medicine.
> I have three groups of patients, and I present a 10*3 table of their
> characteristics in Table 1. Some of their characteristics, e.g. their
> age, are on a continuous scale, others are dichotomous. I am thinking of
> presenting the age distribution in each group as miniature graphs, each
> of which must fit in one table cell. I am hoping that someone can answer
> these questions:
> 
>  
> 
> 1. Has anybody ever seen something like this published anywhere?
> 
> 2. Should I draw the entire table as a figure, or should I make a table
> in Word (or similar) and manually insert the graphs in their cells?
> 

Depending on your needs, there's another solution. You could output 
LaTeX, and compile that to a PDF.  The first thing I thought of when I 
read your topic was the "describe" function in Hmisc.  The help file for 
?describe references

      http://biostat.mc.vanderbilt.edu/twiki/pub/Main/Hmisc/counties.pdf

Probably not exactly what you're looking for, but it might be start. See 
also:

http://texblog.wordpress.com/2008/02/04/placing-graphicsimages-inside-a-table/

I would probably go this route, generating code to produce a LaTeX table 
and the associated image files.  I've also used low-level grid graphics 
function calls (e.g., grid.text ) to produce 'tables' with hazard ratio 
type graphics included as a column. (a 'forest plot').

Hope that helps,
Erik



More information about the R-help mailing list