[R] Hmisc latex function with longtable option

Erik Iverson
Wed, 02 Jul 2008 15:58:25 -0000

Hello -

I'm trying to use Hmisc's latex function to produce a postscript file of
a data.frame, using the longtable = TRUE option.  When I run, for example,

## sample R code
dvips(latex(data.frame(a = rnorm(100), b = rnorm(100)),
             longtable = TRUE), file = "test.ps")

latex runs successfully and a test.ps file is produced.  However, I see
the following in the output that the latex command sends to the R buffer.

...
Package longtable Warning: Column widths have changed
(longtable)                in table 1 on input line 121.


Package longtable Warning: Table widths have changed. Rerun LaTeX.
...

And the resulting test.ps file has the column headings not aligned (in
my real life example, there are other misalignments).

To resolve this, I am currently going into the /tmp/Rtmp****/ directory
where the .tex files are created by the dvi.latex function, and
rerunning latex on the appropriate file****.tex file.

Is there any thing I'm missing that would make this easier?

Thanks,
Erik Iverson
iverson at biostat.wisc.edu