Hi

On 29/10/2010 7:55 p.m., robbert blonk wrote:

Dear all,

I would like to underline only the colnames in a table as e.g.

grid.draw(tableGrob(head(iris, 10), name="test"))

I can imagine you should use grid.edit or so, bu I can't figure out
how...

Does anyone have a suggestion?

Unfortunately, grid.edit() won't help here because the table is all drawn on-the-fly ; the only thing you can see is the overall table grob.

You can see the viewports that are used to draw the table, but the downside there is that they do not have very useful names.

The following code draws the table, then looks into the viewport tree to get the name of the 12th table viewport (which is the first viewport on the second column), navigates down to that viewport, then draws a line along the bottom.

grid.table(head(iris, 10), name="test")
downViewport(current.vpTree()$children[[1]]$children[[12]]$name)
grid.segments(0, 0, 1, 0)

Not a very general solution, but may provide a one-off workaround.

Is that what you meant?

Paul

Thanks Robbert

windows xp R 2.10.1


--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
R-help@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.

Reply via email to