7

There are couple of helpful posts round dealing with xtable but no one deals with this as far as my search abilities go.

I would like to adjust row height in xtable (print). I'm printing a data.frame.

print(xtable(...),...)

Please note that I'm already using add.to.row

addtorow <- list()
addtorow$pos <- list()
addtorow$pos[[1]] <- c(0)
addtorow$command <- c(paste("\\hline \n","\\hline \n",sep=""))

So what I would like to do is to widen the upper row space:

enter image description here

I have tried all kind of things but always just messing around what I have already nicely done.

Maximilian
  • 4,177
  • 7
  • 46
  • 85
  • Perhaps you can add a strut of the appropriate height. That would expand the height, but not print anything. I'm not exactly sure how to do this so I'm only leaving it as a comment, not a full answer. – Brian Diggs Oct 18 '13 at 15:55
  • Adding extra vertical space is usually done by adding [_x_pt] after \\, and that should be possible to achieve using the `add.to.row` argument of `print.xtable()`. If you show your full `print()` command (and preferably a MWE) you may get a better answer. – solarchemist Oct 19 '13 at 19:19

2 Answers2

4

You could simply use the booktabs option which increases the padding around the horizontal lines

print(xtable(...),booktabs = T)
AndB
  • 181
  • 4
0

Not sure exactly the context here- if you're using LaTeX or if you're printing the table in html (using R Markdown and rendering as a webpage. In the latter case you can specify padding on the table cells using CSS rules at the top of your document between style tags:

<style>
  th,td{
     padding:2px 5px 2px 5px;
  }
</style>
Michael Discenza
  • 3,240
  • 7
  • 30
  • 41