1

I am attempting to use grid.table to produce an image of a table for placement in a word document using Rstudio-knitr-pandoc. It is rather large with long column names. The solution I would like to accomplish is rotating the column headings to 90 vertical. Is this possible with grid.table or any other means?

I have tried

toxinsGrob<-tableGrob(cyano.x.t,name='toxins',edits=gEdit(gPath='gpar.coltext',rot=90)) grid.draw(toxinsGrob)

to no avail. Suggetions?

Joel

JAllen
  • 638
  • 6
  • 18
  • try the packages xtable or pander and/or the knitr command `kable(table)` have a look at their documentation, I only know how to do this in latex or with html-tables using xtable, so I have no idea if it even works with word – grrgrrbla May 26 '15 at 14:45
  • my workaround is to edit the tables in word. this doc only has this table that needs altering so little motivation for really looking into it... – JAllen Jun 01 '15 at 17:56

1 Answers1

4

it's easy with the new version of grid.table,

tt = ttheme_default(colhead=list(fg_params=list(rot=90)))
grid.newpage()
grid.table(head(iris), theme=tt)

enter image description here

baptiste
  • 75,767
  • 19
  • 198
  • 294