[R] sweave tables as images?

Alexander Shenkin ashenkin at ufl.edu
Fri May 25 21:44:52 CEST 2012


grid.table() works well, but using it in sweave creates graphics with
very wide margins.  I'm sure this has something to do with grid, and not
just grid.table.  Any idea how I can clip the graphic to the edges of
the table graphic?  I've looked into viewports, etc, but I can't seem to
find anything that will clip a graphic to its edges, perhaps with some
defined margin.

any help greatly appreciated!

thanks,
allie

On 5/21/2012 3:33 PM, R. Michael Weylandt wrote:
> Take a look at addtable2plot in plotrix or grid.table / tableGrob in
> gridExtras.
> 
> Michael
> 
> On Mon, May 21, 2012 at 4:29 PM, Alexander Shenkin <ashenkin at ufl.edu> wrote:
>> Hello folks,
>>
>> I've been on a journey trying to figure out how to manage documents that
>> are amenable to sharing and editing, but that contain dynamic content
>> generated by R.  I've come to the following solution: I use Sweave to
>> generate labeled png & pdf figures, and I "Insert & Link" those figures
>> as "Pictures" in a Word 2010 doc.  Thus, when data or code changes, I
>> regenerate the figures with Sweave, open the Word doc and hit "F9", and
>> all the figures are automatically updated.  I can send the file around,
>> folks can comment and edit, track changes, etc.
>>
>> Now, however, I'm trying to do the same for tables that I did for
>> figures, and it seems a bit more difficult.  I can spit out tex tables
>> into separate files using the "split=TRUE" chunk option, and I can even
>> make those tables into html with xtable(type="html").  Word, however,
>> doesn't have the "Insert & Link" option for external text files (which
>> makes it such that, if the external file isn't found, Word uses a copy
>> stored in the doc).
>>
>> So, I think it will be better if I can somehow generate the tables as
>> images.  Is there any way to generate tables as images in separate files
>> in Sweave?  Or, is there another tree up which I should be barking?
>>
>> Thanks,
>> Allie
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list